security/nss/cmd/libpkix/testutil/testutil.c

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rwxr-xr-x

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 4 /*
michael@0 5 * testutil.c
michael@0 6 *
michael@0 7 * Utility error handling functions
michael@0 8 *
michael@0 9 */
michael@0 10
michael@0 11 #include "testutil.h"
michael@0 12
michael@0 13 /*
michael@0 14 * static global variable to keep track of total number of errors for
michael@0 15 * a particular test suite (eg. all the OID tests)
michael@0 16 */
michael@0 17 static int errCount = 0;
michael@0 18
michael@0 19 /*
michael@0 20 * FUNCTION: startTests
michael@0 21 * DESCRIPTION:
michael@0 22 *
michael@0 23 * Prints standard message for starting the test suite with the name pointed
michael@0 24 * to by "testName". This function should be called in the beginning of every
michael@0 25 * test suite.
michael@0 26 *
michael@0 27 * PARAMETERS:
michael@0 28 * "testName"
michael@0 29 * Address of string representing name of test suite.
michael@0 30 * THREAD SAFETY:
michael@0 31 * Not Thread Safe - assumes exclusive access to "errCount"
michael@0 32 * (see Thread Safety Definitions in Programmer's Guide)
michael@0 33 * RETURNS:
michael@0 34 * Returns nothing.
michael@0 35 */
michael@0 36 void
michael@0 37 startTests(char *testName)
michael@0 38 {
michael@0 39 (void) printf("*START OF TESTS FOR %s:\n", testName);
michael@0 40 errCount = 0;
michael@0 41 }
michael@0 42
michael@0 43 /*
michael@0 44 * FUNCTION: endTests
michael@0 45 * DESCRIPTION:
michael@0 46 *
michael@0 47 * Prints standard message for ending the test suite with the name pointed
michael@0 48 * to by "testName", followed by a success/failure message. This function
michael@0 49 * should be called at the end of every test suite.
michael@0 50 *
michael@0 51 * PARAMETERS:
michael@0 52 * "testName"
michael@0 53 * Address of string representing name of test suite.
michael@0 54 * THREAD SAFETY:
michael@0 55 * Not Thread Safe - assumes exclusive access to "errCount"
michael@0 56 * (see Thread Safety Definitions in Programmer's Guide)
michael@0 57 * RETURNS:
michael@0 58 * Returns nothing.
michael@0 59 */
michael@0 60 void
michael@0 61 endTests(char *testName)
michael@0 62 {
michael@0 63 char plural = ' ';
michael@0 64
michael@0 65 (void) printf("*END OF TESTS FOR %s: ", testName);
michael@0 66 if (errCount > 0) {
michael@0 67 if (errCount > 1) plural = 's';
michael@0 68 (void) printf("%d SUBTEST%c FAILED.\n\n", errCount, plural);
michael@0 69 } else {
michael@0 70 (void) printf("ALL TESTS COMPLETED SUCCESSFULLY.\n\n");
michael@0 71 }
michael@0 72 }
michael@0 73
michael@0 74 /*
michael@0 75 * FUNCTION: subTest
michael@0 76 * DESCRIPTION:
michael@0 77 *
michael@0 78 * Prints standard message for starting the subtest with the name pointed to
michael@0 79 * by "subTestName". This function should be called at the beginning of each
michael@0 80 * subtest.
michael@0 81 *
michael@0 82 * PARAMETERS:
michael@0 83 * "subTestName"
michael@0 84 * Address of string representing name of subTest.
michael@0 85 * THREAD SAFETY:
michael@0 86 * Thread Safe (see Thread Safety Definitions in Programmer's Guide)
michael@0 87 * RETURNS:
michael@0 88 * Returns nothing.
michael@0 89 */
michael@0 90 void
michael@0 91 subTest(char *subTestName)
michael@0 92 {
michael@0 93 (void) printf("TESTING: %s ...\n", subTestName);
michael@0 94 }
michael@0 95
michael@0 96 /*
michael@0 97 * FUNCTION: testErrorUndo
michael@0 98 * DESCRIPTION:
michael@0 99 *
michael@0 100 * Decrements the global variable "errCount" and prints a test failure
michael@0 101 * expected message followed by the string pointed to by "msg". This function
michael@0 102 * should be called when an expected error condition is encountered in the
michael@0 103 * tests. Calling this function *correct* the previous errCount increment.
michael@0 104 * It should only be called ONCE per subtest.
michael@0 105 *
michael@0 106 * PARAMETERS:
michael@0 107 * "msg"
michael@0 108 * Address of text of error message.
michael@0 109 * THREAD SAFETY:
michael@0 110 * Not Thread Safe - assumes exclusive access to "errCount"
michael@0 111 * (see Thread Safety Definitions in Programmer's Guide)
michael@0 112 * RETURNS:
michael@0 113 * Returns nothing.
michael@0 114 */
michael@0 115 void
michael@0 116 testErrorUndo(char *msg)
michael@0 117 {
michael@0 118 --errCount;
michael@0 119 (void) printf("TEST FAILURE *** EXPECTED *** :%s\n", msg);
michael@0 120 }
michael@0 121
michael@0 122 /*
michael@0 123 * FUNCTION: testError
michael@0 124 * DESCRIPTION:
michael@0 125 *
michael@0 126 * Increments the global variable "errCount" and prints a standard test
michael@0 127 * failure message followed by the string pointed to by "msg". This function
michael@0 128 * should be called when an unexpected error condition is encountered in the
michael@0 129 * tests. It should only be called ONCE per subtest.
michael@0 130 *
michael@0 131 * PARAMETERS:
michael@0 132 * "msg"
michael@0 133 * Address of text of error message.
michael@0 134 * THREAD SAFETY:
michael@0 135 * Not Thread Safe - assumes exclusive access to "errCount"
michael@0 136 * (see Thread Safety Definitions in Programmer's Guide)
michael@0 137 * RETURNS:
michael@0 138 * Returns nothing.
michael@0 139 */
michael@0 140 void
michael@0 141 testError(char *msg)
michael@0 142 {
michael@0 143 ++errCount;
michael@0 144 (void) printf("TEST FAILURE: %s\n", msg);
michael@0 145 }
michael@0 146
michael@0 147 /*
michael@0 148 * FUNCTION: PKIX_String2ASCII
michael@0 149 * DESCRIPTION:
michael@0 150 *
michael@0 151 * Converts String object pointed to by "string" to its ASCII representation
michael@0 152 * and returns the converted value. Returns NULL upon failure.
michael@0 153 *
michael@0 154 * XXX Might want to use ESCASCII_DEBUG to show control characters, etc.
michael@0 155 *
michael@0 156 * PARAMETERS:
michael@0 157 * "string"
michael@0 158 * Address of String to be converted to ASCII. Must be non-NULL.
michael@0 159 * "plContext"
michael@0 160 * Platform-specific context pointer.
michael@0 161 * THREAD SAFETY:
michael@0 162 * Thread Safe (see Thread Safety Definitions in Programmer's Guide)
michael@0 163 * RETURNS:
michael@0 164 * Returns the ASCII representation of "string" upon success;
michael@0 165 * NULL upon failure.
michael@0 166 */
michael@0 167 char *
michael@0 168 PKIX_String2ASCII(PKIX_PL_String *string, void *plContext)
michael@0 169 {
michael@0 170 PKIX_UInt32 length;
michael@0 171 char *asciiString = NULL;
michael@0 172 PKIX_Error *errorResult;
michael@0 173
michael@0 174 errorResult = PKIX_PL_String_GetEncoded
michael@0 175 (string,
michael@0 176 PKIX_ESCASCII,
michael@0 177 (void **)&asciiString,
michael@0 178 &length,
michael@0 179 plContext);
michael@0 180
michael@0 181 if (errorResult) goto cleanup;
michael@0 182
michael@0 183 cleanup:
michael@0 184
michael@0 185 if (errorResult){
michael@0 186 return (NULL);
michael@0 187 }
michael@0 188
michael@0 189 return (asciiString);
michael@0 190
michael@0 191 }
michael@0 192
michael@0 193 /*
michael@0 194 * FUNCTION: PKIX_Error2ASCII
michael@0 195 * DESCRIPTION:
michael@0 196 *
michael@0 197 * Converts Error pointed to by "error" to its ASCII representation and
michael@0 198 * returns the converted value. Returns NULL upon failure.
michael@0 199 *
michael@0 200 * PARAMETERS:
michael@0 201 * "error"
michael@0 202 * Address of Error to be converted to ASCII. Must be non-NULL.
michael@0 203 * "plContext"
michael@0 204 * Platform-specific context pointer.
michael@0 205 * THREAD SAFETY:
michael@0 206 * Thread Safe (see Thread Safety Definitions in Programmer's Guide)
michael@0 207 * RETURNS:
michael@0 208 * Returns the ASCII representation of "error" upon success;
michael@0 209 * NULL upon failure.
michael@0 210 */
michael@0 211 char *
michael@0 212 PKIX_Error2ASCII(PKIX_Error *error, void *plContext)
michael@0 213 {
michael@0 214 PKIX_UInt32 length;
michael@0 215 char *asciiString = NULL;
michael@0 216 PKIX_PL_String *pkixString = NULL;
michael@0 217 PKIX_Error *errorResult = NULL;
michael@0 218
michael@0 219 errorResult = PKIX_PL_Object_ToString
michael@0 220 ((PKIX_PL_Object*)error, &pkixString, plContext);
michael@0 221 if (errorResult) goto cleanup;
michael@0 222
michael@0 223 errorResult = PKIX_PL_String_GetEncoded
michael@0 224 (pkixString,
michael@0 225 PKIX_ESCASCII,
michael@0 226 (void **)&asciiString,
michael@0 227 &length,
michael@0 228 plContext);
michael@0 229
michael@0 230 cleanup:
michael@0 231
michael@0 232 if (pkixString){
michael@0 233 if (PKIX_PL_Object_DecRef
michael@0 234 ((PKIX_PL_Object*)pkixString, plContext)){
michael@0 235 return (NULL);
michael@0 236 }
michael@0 237 }
michael@0 238
michael@0 239 if (errorResult){
michael@0 240 return (NULL);
michael@0 241 }
michael@0 242
michael@0 243 return (asciiString);
michael@0 244 }
michael@0 245
michael@0 246 /*
michael@0 247 * FUNCTION: PKIX_Object2ASCII
michael@0 248 * DESCRIPTION:
michael@0 249 *
michael@0 250 * Converts Object pointed to by "object" to its ASCII representation and
michael@0 251 * returns the converted value. Returns NULL upon failure.
michael@0 252 *
michael@0 253 * PARAMETERS:
michael@0 254 * "object"
michael@0 255 * Address of Object to be converted to ASCII. Must be non-NULL.
michael@0 256 * THREAD SAFETY:
michael@0 257 * Thread Safe (see Thread Safety Definitions in Programmer's Guide)
michael@0 258 * RETURNS:
michael@0 259 * Returns the ASCII representation of "object" upon success;
michael@0 260 * NULL upon failure.
michael@0 261 */
michael@0 262 char *
michael@0 263 PKIX_Object2ASCII(PKIX_PL_Object *object)
michael@0 264 {
michael@0 265 PKIX_UInt32 length;
michael@0 266 char *asciiString = NULL;
michael@0 267 PKIX_PL_String *pkixString = NULL;
michael@0 268 PKIX_Error *errorResult = NULL;
michael@0 269
michael@0 270 errorResult = PKIX_PL_Object_ToString
michael@0 271 (object, &pkixString, NULL);
michael@0 272 if (errorResult) goto cleanup;
michael@0 273
michael@0 274 errorResult = PKIX_PL_String_GetEncoded
michael@0 275 (pkixString, PKIX_ESCASCII, (void **)&asciiString, &length, NULL);
michael@0 276
michael@0 277 cleanup:
michael@0 278
michael@0 279 if (pkixString){
michael@0 280 if (PKIX_PL_Object_DecRef((PKIX_PL_Object*)pkixString, NULL)){
michael@0 281 return (NULL);
michael@0 282 }
michael@0 283 }
michael@0 284
michael@0 285 if (errorResult){
michael@0 286 return (NULL);
michael@0 287 }
michael@0 288
michael@0 289 return (asciiString);
michael@0 290 }
michael@0 291
michael@0 292 /*
michael@0 293 * FUNCTION: PKIX_Cert2ASCII
michael@0 294 * DESCRIPTION:
michael@0 295 *
michael@0 296 * Converts Cert pointed to by "cert" to its partial ASCII representation and
michael@0 297 * returns the converted value. Returns NULL upon failure.
michael@0 298 *
michael@0 299 * PARAMETERS:
michael@0 300 * "cert"
michael@0 301 * Address of Cert to be converted to ASCII. Must be non-NULL.
michael@0 302 * THREAD SAFETY:
michael@0 303 * Thread Safe (see Thread Safety Definitions in Programmer's Guide)
michael@0 304 * RETURNS:
michael@0 305 * Returns the partial ASCII representation of "cert" upon success;
michael@0 306 * NULL upon failure.
michael@0 307 */
michael@0 308 char *
michael@0 309 PKIX_Cert2ASCII(PKIX_PL_Cert *cert)
michael@0 310 {
michael@0 311 PKIX_PL_X500Name *issuer = NULL;
michael@0 312 void *issuerAscii = NULL;
michael@0 313 PKIX_PL_X500Name *subject = NULL;
michael@0 314 void *subjectAscii = NULL;
michael@0 315 void *asciiString = NULL;
michael@0 316 PKIX_Error *errorResult = NULL;
michael@0 317 PKIX_UInt32 numChars;
michael@0 318
michael@0 319 /* Issuer */
michael@0 320 errorResult = PKIX_PL_Cert_GetIssuer(cert, &issuer, NULL);
michael@0 321 if (errorResult) goto cleanup;
michael@0 322
michael@0 323 issuerAscii = PKIX_Object2ASCII((PKIX_PL_Object*)issuer);
michael@0 324
michael@0 325 /* Subject */
michael@0 326 errorResult = PKIX_PL_Cert_GetSubject(cert, &subject, NULL);
michael@0 327 if (errorResult) goto cleanup;
michael@0 328
michael@0 329 if (subject){
michael@0 330 subjectAscii = PKIX_Object2ASCII((PKIX_PL_Object*)subject);
michael@0 331 }
michael@0 332
michael@0 333 errorResult = PKIX_PL_Malloc(200, &asciiString, NULL);
michael@0 334 if (errorResult) goto cleanup;
michael@0 335
michael@0 336 numChars =
michael@0 337 PR_snprintf
michael@0 338 (asciiString,
michael@0 339 200,
michael@0 340 "Issuer=%s\nSubject=%s\n",
michael@0 341 issuerAscii,
michael@0 342 subjectAscii);
michael@0 343
michael@0 344 if (!numChars) goto cleanup;
michael@0 345
michael@0 346 cleanup:
michael@0 347
michael@0 348 if (issuer){
michael@0 349 if (PKIX_PL_Object_DecRef((PKIX_PL_Object*)issuer, NULL)){
michael@0 350 return (NULL);
michael@0 351 }
michael@0 352 }
michael@0 353
michael@0 354 if (subject){
michael@0 355 if (PKIX_PL_Object_DecRef((PKIX_PL_Object*)subject, NULL)){
michael@0 356 return (NULL);
michael@0 357 }
michael@0 358 }
michael@0 359
michael@0 360 if (PKIX_PL_Free((PKIX_PL_Object*)issuerAscii, NULL)){
michael@0 361 return (NULL);
michael@0 362 }
michael@0 363
michael@0 364 if (PKIX_PL_Free((PKIX_PL_Object*)subjectAscii, NULL)){
michael@0 365 return (NULL);
michael@0 366 }
michael@0 367
michael@0 368 if (errorResult){
michael@0 369 return (NULL);
michael@0 370 }
michael@0 371
michael@0 372 return (asciiString);
michael@0 373 }
michael@0 374
michael@0 375 /*
michael@0 376 * FUNCTION: testHashcodeHelper
michael@0 377 * DESCRIPTION:
michael@0 378 *
michael@0 379 * Computes the hashcode of the Object pointed to by "goodObject" and the
michael@0 380 * Object pointed to by "otherObject" and compares them. If the result of the
michael@0 381 * comparison is not the desired match as specified by "match", an error
michael@0 382 * message is generated.
michael@0 383 *
michael@0 384 * PARAMETERS:
michael@0 385 * "goodObject"
michael@0 386 * Address of an object. Must be non-NULL.
michael@0 387 * "otherObject"
michael@0 388 * Address of another object. Must be non-NULL.
michael@0 389 * "match"
michael@0 390 * Boolean value representing the desired comparison result.
michael@0 391 * "plContext"
michael@0 392 * Platform-specific context pointer.
michael@0 393 * THREAD SAFETY:
michael@0 394 * Thread Safe (see Thread Safety Definitions in Programmer's Guide)
michael@0 395 * RETURNS:
michael@0 396 * Returns nothing.
michael@0 397 */
michael@0 398 void
michael@0 399 testHashcodeHelper(
michael@0 400 PKIX_PL_Object *goodObject,
michael@0 401 PKIX_PL_Object *otherObject,
michael@0 402 PKIX_Boolean match,
michael@0 403 void *plContext)
michael@0 404 {
michael@0 405
michael@0 406 PKIX_UInt32 goodHash;
michael@0 407 PKIX_UInt32 otherHash;
michael@0 408 PKIX_Boolean cmpResult;
michael@0 409 PKIX_TEST_STD_VARS();
michael@0 410
michael@0 411 PKIX_TEST_EXPECT_NO_ERROR(PKIX_PL_Object_Hashcode
michael@0 412 ((PKIX_PL_Object *)goodObject, &goodHash, plContext));
michael@0 413
michael@0 414 PKIX_TEST_EXPECT_NO_ERROR(PKIX_PL_Object_Hashcode
michael@0 415 ((PKIX_PL_Object *)otherObject, &otherHash, plContext));
michael@0 416
michael@0 417 cmpResult = (goodHash == otherHash);
michael@0 418
michael@0 419 if ((match && !cmpResult) || (!match && cmpResult)){
michael@0 420 testError("unexpected mismatch");
michael@0 421 (void) printf("Hash1:\t%d\n", goodHash);
michael@0 422 (void) printf("Hash2:\t%d\n", otherHash);
michael@0 423 }
michael@0 424
michael@0 425 cleanup:
michael@0 426
michael@0 427 PKIX_TEST_RETURN();
michael@0 428
michael@0 429 }
michael@0 430
michael@0 431 /*
michael@0 432 * FUNCTION: testToStringHelper
michael@0 433 * DESCRIPTION:
michael@0 434 *
michael@0 435 * Calls toString on the Object pointed to by "goodObject" and compares the
michael@0 436 * result to the string pointed to by "expected". If the results are not
michael@0 437 * equal, an error message is generated.
michael@0 438 *
michael@0 439 * PARAMETERS:
michael@0 440 * "goodObject"
michael@0 441 * Address of Object. Must be non-NULL.
michael@0 442 * "expected"
michael@0 443 * Address of the desired string.
michael@0 444 * "plContext"
michael@0 445 * Platform-specific context pointer.
michael@0 446 * THREAD SAFETY:
michael@0 447 * Thread Safe (see Thread Safety Definitions in Programmer's Guide)
michael@0 448 * RETURNS:
michael@0 449 * Returns nothing.
michael@0 450 */
michael@0 451 void
michael@0 452 testToStringHelper(
michael@0 453 PKIX_PL_Object *goodObject,
michael@0 454 char *expected,
michael@0 455 void *plContext)
michael@0 456 {
michael@0 457 PKIX_PL_String *stringRep = NULL;
michael@0 458 char *actual = NULL;
michael@0 459 PKIX_TEST_STD_VARS();
michael@0 460
michael@0 461 PKIX_TEST_EXPECT_NO_ERROR(PKIX_PL_Object_ToString
michael@0 462 (goodObject, &stringRep, plContext));
michael@0 463
michael@0 464 actual = PKIX_String2ASCII(stringRep, plContext);
michael@0 465 if (actual == NULL){
michael@0 466 pkixTestErrorMsg = "PKIX_String2ASCII Failed";
michael@0 467 goto cleanup;
michael@0 468 }
michael@0 469
michael@0 470 /*
michael@0 471 * If you are having trouble matching the string, uncomment the
michael@0 472 * PL_strstr function to figure out what's going on.
michael@0 473 */
michael@0 474
michael@0 475 /*
michael@0 476 if (PL_strstr(actual, expected) == NULL){
michael@0 477 testError("PL_strstr failed");
michael@0 478 }
michael@0 479 */
michael@0 480
michael@0 481
michael@0 482 if (PL_strcmp(actual, expected) != 0){
michael@0 483 testError("unexpected mismatch");
michael@0 484 (void) printf("Actual value:\t%s\n", actual);
michael@0 485 (void) printf("Expected value:\t%s\n", expected);
michael@0 486 }
michael@0 487
michael@0 488 cleanup:
michael@0 489
michael@0 490 PKIX_PL_Free(actual, plContext);
michael@0 491
michael@0 492 PKIX_TEST_DECREF_AC(stringRep);
michael@0 493
michael@0 494 PKIX_TEST_RETURN();
michael@0 495 }
michael@0 496
michael@0 497 /*
michael@0 498 * FUNCTION: testEqualsHelper
michael@0 499 * DESCRIPTION:
michael@0 500 *
michael@0 501 * Checks if the Object pointed to by "goodObject" is Equal to the Object
michael@0 502 * pointed to by "otherObject". If the result of the check is not the desired
michael@0 503 * match as specified by "match", an error message is generated.
michael@0 504 *
michael@0 505 * PARAMETERS:
michael@0 506 * "goodObject"
michael@0 507 * Address of an Object. Must be non-NULL.
michael@0 508 * "otherObject"
michael@0 509 * Address of another Object. Must be non-NULL.
michael@0 510 * "match"
michael@0 511 * Boolean value representing the desired comparison result.
michael@0 512 * "plContext"
michael@0 513 * Platform-specific context pointer.
michael@0 514 * THREAD SAFETY:
michael@0 515 * Thread Safe (see Thread Safety Definitions in Programmer's Guide)
michael@0 516 * RETURNS:
michael@0 517 * Returns nothing.
michael@0 518 */
michael@0 519 void
michael@0 520 testEqualsHelper(
michael@0 521 PKIX_PL_Object *goodObject,
michael@0 522 PKIX_PL_Object *otherObject,
michael@0 523 PKIX_Boolean match,
michael@0 524 void *plContext)
michael@0 525 {
michael@0 526
michael@0 527 PKIX_Boolean cmpResult;
michael@0 528 PKIX_TEST_STD_VARS();
michael@0 529
michael@0 530 PKIX_TEST_EXPECT_NO_ERROR
michael@0 531 (PKIX_PL_Object_Equals
michael@0 532 (goodObject, otherObject, &cmpResult, plContext));
michael@0 533
michael@0 534 if ((match && !cmpResult) || (!match && cmpResult)){
michael@0 535 testError("unexpected mismatch");
michael@0 536 (void) printf("Actual value:\t%d\n", cmpResult);
michael@0 537 (void) printf("Expected value:\t%d\n", match);
michael@0 538 }
michael@0 539
michael@0 540 cleanup:
michael@0 541
michael@0 542 PKIX_TEST_RETURN();
michael@0 543 }
michael@0 544
michael@0 545
michael@0 546 /*
michael@0 547 * FUNCTION: testDuplicateHelper
michael@0 548 * DESCRIPTION:
michael@0 549 * Checks if the Object pointed to by "object" is equal to its duplicate.
michael@0 550 * If the result of the check is not equality, an error message is generated.
michael@0 551 * PARAMETERS:
michael@0 552 * "object"
michael@0 553 * Address of Object. Must be non-NULL.
michael@0 554 * "plContext"
michael@0 555 * Platform-specific context pointer.
michael@0 556 * THREAD SAFETY:
michael@0 557 * Thread Safe (see Thread Safety Definitions in Programmer's Guide)
michael@0 558 * RETURNS:
michael@0 559 * Returns nothing.
michael@0 560 */
michael@0 561 void
michael@0 562 testDuplicateHelper(PKIX_PL_Object *object, void *plContext)
michael@0 563 {
michael@0 564 PKIX_PL_Object *newObject = NULL;
michael@0 565 PKIX_Boolean cmpResult;
michael@0 566
michael@0 567 PKIX_TEST_STD_VARS();
michael@0 568
michael@0 569 PKIX_TEST_EXPECT_NO_ERROR(PKIX_PL_Object_Duplicate
michael@0 570 (object, &newObject, plContext));
michael@0 571
michael@0 572 PKIX_TEST_EXPECT_NO_ERROR(PKIX_PL_Object_Equals
michael@0 573 (object, newObject, &cmpResult, plContext));
michael@0 574
michael@0 575 if (!cmpResult){
michael@0 576 testError("unexpected mismatch");
michael@0 577 (void) printf("Actual value:\t%d\n", cmpResult);
michael@0 578 (void) printf("Expected value:\t%d\n", PKIX_TRUE);
michael@0 579 }
michael@0 580
michael@0 581 cleanup:
michael@0 582
michael@0 583 PKIX_TEST_DECREF_AC(newObject);
michael@0 584
michael@0 585 PKIX_TEST_RETURN();
michael@0 586 }

mercurial