Changeset 2273 for trunk/psLib/test/collections/tst_psList.c
- Timestamp:
- Nov 3, 2004, 3:05:00 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/collections/tst_psList.c (modified) (77 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/collections/tst_psList.c
r2204 r2273 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1.1 7$ $Name: not supported by cvs2svn $9 * @date $Date: 2004-1 0-27 00:57:33$8 * @version $Revision: 1.18 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2004-11-04 01:05:00 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 44 44 45 45 if (! runTestSuite(stderr,"psList",tests,argc,argv) ) { 46 psError( __FILE__,"One or more tests failed");46 psError(PS_ERR_UNKNOWN,true,"One or more tests failed"); 47 47 return 1; 48 48 } … … 66 66 list = psListAlloc(NULL); 67 67 if (list == NULL) { 68 psError( __func__,"psListAlloc failed to return a list.");68 psError(PS_ERR_UNKNOWN, true,"psListAlloc failed to return a list."); 69 69 return 1; 70 70 } 71 71 72 72 if (list->head != NULL || list->tail != NULL) { 73 psError( __func__,"head and/or tail was not NULL for empty list.");73 psError(PS_ERR_UNKNOWN, true,"head and/or tail was not NULL for empty list."); 74 74 return 2; 75 75 } 76 76 77 77 if (list->size != 0) { 78 psError( __func__,"size of list wasn't zero for empty list.");78 psError(PS_ERR_UNKNOWN, true,"size of list wasn't zero for empty list."); 79 79 return 3; 80 80 } … … 84 84 list = psListAlloc(data); 85 85 if (list == NULL) { 86 psError( __func__,"psListAlloc failed to return a list.");86 psError(PS_ERR_UNKNOWN, true,"psListAlloc failed to return a list."); 87 87 return 4; 88 88 } 89 89 90 90 if (list->head == NULL || list->tail == NULL) { 91 psError( __func__,"head and/or tail was NULL for one-element new list.");91 psError(PS_ERR_UNKNOWN, true,"head and/or tail was NULL for one-element new list."); 92 92 return 5; 93 93 } 94 94 95 95 if (list->head->data != data || list->tail->data != data) { 96 psError( __func__,"head and/or tail didn't point to data's node for one-element new list.");96 psError(PS_ERR_UNKNOWN, true,"head and/or tail didn't point to data's node for one-element new list."); 97 97 return 6; 98 98 } 99 99 100 100 if (list->size != 1) { 101 psError( __func__,"size of list wasn't correctly set for new, one-element list.");101 psError(PS_ERR_UNKNOWN, true,"size of list wasn't correctly set for new, one-element list."); 102 102 return 7; 103 103 } … … 105 105 ref = psMemGetRefCounter(data); 106 106 if (ref != 2) { 107 psError( __func__,"psList didn't increment reference count of data (%d.",ref);107 psError(PS_ERR_UNKNOWN, true,"psList didn't increment reference count of data (%d.",ref); 108 108 return 8; 109 109 } … … 139 139 // 1. list is NULL (error) 140 140 if (psListAdd(NULL,PS_LIST_HEAD,data)) { 141 psError( __func__,"psListAdd was given a NULL list, but returned a true/success.");141 psError(PS_ERR_UNKNOWN, true,"psListAdd was given a NULL list, but returned a true/success."); 142 142 return 1; 143 143 } … … 146 146 psFree(data); 147 147 if (list->size != 1) { 148 psError( __func__,"psListAlloc didn't create a list properly.");148 psError(PS_ERR_UNKNOWN, true,"psListAlloc didn't create a list properly."); 149 149 return 2; 150 150 } … … 152 152 // 2. data is NULL (error, list should not grow) 153 153 if (psListAdd(list, PS_LIST_HEAD,NULL)) { 154 psError( __func__,"psListAdd successfully added a NULL data item?");154 psError(PS_ERR_UNKNOWN, true,"psListAdd successfully added a NULL data item?"); 155 155 return 40; 156 156 } 157 157 if ( list->size != 1) { 158 psError( __func__,"psListAdd with a NULL data element changed the list size or returned success.");158 psError(PS_ERR_UNKNOWN, true,"psListAdd with a NULL data element changed the list size or returned success."); 159 159 return 3; 160 160 } … … 164 164 *data = 2; 165 165 if ( ! psListAdd(list,PS_LIST_HEAD,data) ) { 166 psError( __func__,"psListAdd failed to add a data item to head.");166 psError(PS_ERR_UNKNOWN, true,"psListAdd failed to add a data item to head."); 167 167 return 21; 168 168 } 169 169 170 170 if (psMemGetRefCounter(data) != 2) { 171 psError( __func__,"psListAdd didn't increment the data reference count.");171 psError(PS_ERR_UNKNOWN, true,"psListAdd didn't increment the data reference count."); 172 172 return 20; 173 173 } … … 176 176 // verify that the size incremented 177 177 if (list->size != 2) { 178 psError( __func__,"psListAdd didn't increment the size by one");178 psError(PS_ERR_UNKNOWN, true,"psListAdd didn't increment the size by one"); 179 179 return 4; 180 180 } … … 182 182 // verify that the head is the inserted data item 183 183 if (*(psS32*)list->head->data != 2) { 184 psError( __func__,"psListAdd with PS_LIST_HEAD didn't insert at the head.");184 psError(PS_ERR_UNKNOWN, true,"psListAdd with PS_LIST_HEAD didn't insert at the head."); 185 185 return 5; 186 186 } … … 189 189 *data = 3; 190 190 if ( ! psListAdd(list,PS_LIST_TAIL,data) ) { 191 psError( __func__,"psListAdd failed to add a data item to tail.");191 psError(PS_ERR_UNKNOWN, true,"psListAdd failed to add a data item to tail."); 192 192 return 21; 193 193 } 194 194 195 195 if (psMemGetRefCounter(data) != 2) { 196 psError( __func__,"psListAdd didn't increment the data reference count.");196 psError(PS_ERR_UNKNOWN, true,"psListAdd didn't increment the data reference count."); 197 197 return 22; 198 198 } … … 200 200 // verify that the size incremented 201 201 if (list->size != 3) { 202 psError( __func__,"psListAdd didn't increment the size by 1");202 psError(PS_ERR_UNKNOWN, true,"psListAdd didn't increment the size by 1"); 203 203 return 6; 204 204 } … … 206 206 // verify that the head is still the same 207 207 if (*(psS32*)list->head->data != 2) { 208 psError( __func__,"psListAdd with PS_LIST_TAIL modified the head.");208 psError(PS_ERR_UNKNOWN, true,"psListAdd with PS_LIST_TAIL modified the head."); 209 209 return 7; 210 210 } … … 212 212 // verify that the tail is the data item inserted 213 213 if (*(psS32*)list->tail->data != 3) { 214 psError( __func__,"psListAdd with PS_LIST_TAIL didn't insert at the tail.");214 psError(PS_ERR_UNKNOWN, true,"psListAdd with PS_LIST_TAIL didn't insert at the tail."); 215 215 return 8; 216 216 } … … 223 223 224 224 if ( psListAdd(list,-10,data) ) { 225 psError( __func__,"psListAdd successfully added data to a -10 position?");225 psError(PS_ERR_UNKNOWN, true,"psListAdd successfully added data to a -10 position?"); 226 226 return 30; 227 227 } 228 228 if (psMemGetRefCounter(data) != 1) { 229 psError( __func__,"psListAdd incremented the data reference count.");229 psError(PS_ERR_UNKNOWN, true,"psListAdd incremented the data reference count."); 230 230 return 24; 231 231 } … … 234 234 if (list->size != 3) { 235 235 printListInt(list); 236 psError( __func__,"psListAdd didn't insert to head when where was invalid.");236 psError(PS_ERR_UNKNOWN, true,"psListAdd didn't insert to head when where was invalid."); 237 237 return 9; 238 238 } … … 243 243 244 244 if ( ! psListAdd(list,1,data) ) { 245 psError( __func__,"psListAdd failed to add data to 1 position.");245 psError(PS_ERR_UNKNOWN, true,"psListAdd failed to add data to 1 position."); 246 246 return 30; 247 247 } 248 248 249 249 if (psMemGetRefCounter(data) != 2) { 250 psError( __func__,"psListAdd didn't increment the data reference count.");250 psError(PS_ERR_UNKNOWN, true,"psListAdd didn't increment the data reference count."); 251 251 return 25; 252 252 } … … 255 255 if (list->size != 4 || *(psS32*)list->head->next->data != 5) { 256 256 printListInt(list); 257 psError( __func__,"psListAdd didn't insert to position #1.");257 psError(PS_ERR_UNKNOWN, true,"psListAdd didn't insert to position #1."); 258 258 return 10; 259 259 } … … 262 262 *data = 6; 263 263 if ( ! psListAdd(list,3,data) ) { 264 psError( __func__,"psListAdd failed to add data to 4 position.");264 psError(PS_ERR_UNKNOWN, true,"psListAdd failed to add data to 4 position."); 265 265 return 31; 266 266 } 267 267 if (psMemGetRefCounter(data) != 2) { 268 psError( __func__,"psListAdd didn't increment the data reference count.");268 psError(PS_ERR_UNKNOWN, true,"psListAdd didn't increment the data reference count."); 269 269 return 26; 270 270 } … … 273 273 if (list->size != 5 || *(psS32 *)list->head->next->next->next->data != 6) { 274 274 printListInt(list); 275 psError( __func__,"psListAdd didn't insert to position #4.");275 psError(PS_ERR_UNKNOWN, true,"psListAdd didn't insert to position #4."); 276 276 return 50; 277 277 } … … 280 280 *data = 7; 281 281 if ( ! psListAdd(list,2,data) ) { 282 psError( __func__,"psListAdd failed to add data to 2 position.");282 psError(PS_ERR_UNKNOWN, true,"psListAdd failed to add data to 2 position."); 283 283 return 32; 284 284 } 285 285 if (psMemGetRefCounter(data) != 2) { 286 psError( __func__,"psListAdd didn't increment the data reference count.");286 psError(PS_ERR_UNKNOWN, true,"psListAdd didn't increment the data reference count."); 287 287 return 28; 288 288 } … … 291 291 if (list->size != 6 || *(psS32 *)list->head->next->next->data != 7) { 292 292 printListInt(list); 293 psError( __func__,"psListAdd didn't insert to position #2.");293 psError(PS_ERR_UNKNOWN, true,"psListAdd didn't insert to position #2."); 294 294 return 11; 295 295 } … … 300 300 301 301 if ( ! psListAdd(list,9,data) ) { 302 psError( __func__,"psListAdd failed to add data to a 9 position?");302 psError(PS_ERR_UNKNOWN, true,"psListAdd failed to add data to a 9 position?"); 303 303 return 30; 304 304 } 305 305 306 306 if (psMemGetRefCounter(data) != 2) { 307 psError( __func__,"psListAdd didn't increment the data reference count.");307 psError(PS_ERR_UNKNOWN, true,"psListAdd didn't increment the data reference count."); 308 308 return 29; 309 309 } … … 314 314 if (list->size != 7) { 315 315 printListInt(list); 316 psError( __func__,"psListAdd didn't insert to position #9.");316 psError(PS_ERR_UNKNOWN, true,"psListAdd didn't insert to position #9."); 317 317 return 12; 318 318 } … … 366 366 psLogMsg(__func__,PS_LOG_INFO,"Following should be an error"); 367 367 if (psListGet(list,PS_LIST_HEAD) != NULL) { 368 psError( __func__,"psListGet didn't return NULL given a NULL list.");368 psError(PS_ERR_UNKNOWN, true,"psListGet didn't return NULL given a NULL list."); 369 369 return 1; 370 370 }; … … 394 394 data = (psS32*)psListGet(list,3); 395 395 if (data == NULL || *data != 3) { 396 psError( __func__,"psListGet failed with which=3");396 psError(PS_ERR_UNKNOWN, true,"psListGet failed with which=3"); 397 397 return 2; 398 398 } 399 399 data = (psS32*)psListGet(list,1); 400 400 if (data == NULL || *data != 1) { 401 psError( __func__,"psListGet failed with which=1");401 psError(PS_ERR_UNKNOWN, true,"psListGet failed with which=1"); 402 402 return 3; 403 403 } … … 406 406 data = (psS32*)psListGet(list,5); 407 407 if (data != NULL) { 408 psError( __func__,"psListGet failed with which=5");408 psError(PS_ERR_UNKNOWN, true,"psListGet failed with which=5"); 409 409 return 4; 410 410 } 411 411 data = (psS32*)psListGet(list,4); 412 412 if (data != NULL) { 413 psError( __func__,"psListGet failed with which=4");413 psError(PS_ERR_UNKNOWN, true,"psListGet failed with which=4"); 414 414 return 5; 415 415 } … … 418 418 data = (psS32*)psListGet(list,PS_LIST_HEAD); 419 419 if (data == NULL || *data != 0) { 420 psError( __func__,"psListGet failed with which=PS_LIST_HEAD");420 psError(PS_ERR_UNKNOWN, true,"psListGet failed with which=PS_LIST_HEAD"); 421 421 return 6; 422 422 } … … 425 425 data = (psS32*)psListGet(list,PS_LIST_NEXT); 426 426 if (data == NULL || *data != 1) { 427 psError( __func__,"psListGet failed with which=PS_LIST_NEXT");427 psError(PS_ERR_UNKNOWN, true,"psListGet failed with which=PS_LIST_NEXT"); 428 428 return 7; 429 429 } … … 432 432 data = (psS32*)psListGet(list,PS_LIST_TAIL); 433 433 if (data == NULL || *data != 3) { 434 psError( __func__,"psListGet failed with which=PS_LIST_TAIL");434 psError(PS_ERR_UNKNOWN, true,"psListGet failed with which=PS_LIST_TAIL"); 435 435 return 8; 436 436 } … … 439 439 data = (psS32*)psListGet(list,PS_LIST_PREVIOUS); 440 440 if (data == NULL || *data != 2) { 441 psError( __func__,"psListGet failed with which=PS_LIST_PREV");441 psError(PS_ERR_UNKNOWN, true,"psListGet failed with which=PS_LIST_PREV"); 442 442 return 9; 443 443 } … … 473 473 psLogMsg(__func__,PS_LOG_INFO,"Following should be an error"); 474 474 if (psListRemove(list,PS_LIST_HEAD,NULL)) { 475 psError( __func__,"psListRemove didn't return false given a NULL list.");475 psError(PS_ERR_UNKNOWN, true,"psListRemove didn't return false given a NULL list."); 476 476 return 1; 477 477 }; … … 493 493 (psListGet(list,PS_LIST_HEAD) == data) ) { 494 494 printListInt(list); 495 psError( __func__,"Failed to remove PS_LIST_HEAD");495 psError(PS_ERR_UNKNOWN, true,"Failed to remove PS_LIST_HEAD"); 496 496 return 1; 497 497 } … … 499 499 if (list->size != 14) { 500 500 printListInt(list); 501 psError( __func__,"Didn't decrement size properly to 14.");501 psError(PS_ERR_UNKNOWN, true,"Didn't decrement size properly to 14."); 502 502 return 1; 503 503 } … … 508 508 (psListGet(list,PS_LIST_TAIL) == data) ) { 509 509 printListInt(list); 510 psError( __func__,"Failed to remove PS_LIST_TAIL");510 psError(PS_ERR_UNKNOWN, true,"Failed to remove PS_LIST_TAIL"); 511 511 return 1; 512 512 } … … 514 514 if (list->size != 13) { 515 515 printListInt(list); 516 psError( __func__,"Didn't decrement size properly to 13.");516 psError(PS_ERR_UNKNOWN, true,"Didn't decrement size properly to 13."); 517 517 return 1; 518 518 } … … 522 522 if (! psListRemove(list,PS_LIST_NEXT,NULL)) { 523 523 printListInt(list); 524 psError( __func__,"Failed to remove PS_LIST_NEXT @ PS_LIST_HEAD");524 psError(PS_ERR_UNKNOWN, true,"Failed to remove PS_LIST_NEXT @ PS_LIST_HEAD"); 525 525 return 1; 526 526 } … … 528 528 if (list->size != 12) { 529 529 printListInt(list); 530 psError( __func__,"Didn't decrement size properly to 12.");530 psError(PS_ERR_UNKNOWN, true,"Didn't decrement size properly to 12."); 531 531 return 1; 532 532 } … … 536 536 if (psListRemove(list,PS_LIST_NEXT,NULL)) { 537 537 printListInt(list); 538 psError( __func__,"Removed something with PS_LIST_NEXT @ PS_LIST_TAIL");538 psError(PS_ERR_UNKNOWN, true,"Removed something with PS_LIST_NEXT @ PS_LIST_TAIL"); 539 539 return 1; 540 540 } … … 545 545 ( psListGet(list,3) == data) ) { 546 546 printListInt(list); 547 psError( __func__,"Failed to remove PS_LIST_NEXT @ which=2");547 psError(PS_ERR_UNKNOWN, true,"Failed to remove PS_LIST_NEXT @ which=2"); 548 548 return 1; 549 549 } … … 551 551 if (list->size != 11) { 552 552 printListInt(list); 553 psError( __func__,"Didn't decrement size properly to 11.");553 psError(PS_ERR_UNKNOWN, true,"Didn't decrement size properly to 11."); 554 554 return 1; 555 555 } … … 560 560 if (psListRemove(list,PS_LIST_PREVIOUS,NULL)) { 561 561 printListInt(list); 562 psError( __func__,"removed something for PS_LIST_PREVIOUS @ PS_LIST_HEAD");562 psError(PS_ERR_UNKNOWN, true,"removed something for PS_LIST_PREVIOUS @ PS_LIST_HEAD"); 563 563 return 1; 564 564 } … … 569 569 (psListGet(list,9) == data) ) { 570 570 printListInt(list); 571 psError( __func__,"Failed to remove PS_LIST_PREVIOUS @ PS_LIST_TAIL");571 psError(PS_ERR_UNKNOWN, true,"Failed to remove PS_LIST_PREVIOUS @ PS_LIST_TAIL"); 572 572 return 1; 573 573 } … … 575 575 if (list->size != 10) { 576 576 printListInt(list); 577 psError( __func__,"Didn't decrement size properly to 10.");577 psError(PS_ERR_UNKNOWN, true,"Didn't decrement size properly to 10."); 578 578 return 1; 579 579 } … … 584 584 ( psListGet(list,1) == data) ) { 585 585 printListInt(list); 586 psError( __func__,"Failed to remove PS_LIST_PREVIOUS @ which=2");586 psError(PS_ERR_UNKNOWN, true,"Failed to remove PS_LIST_PREVIOUS @ which=2"); 587 587 return 1; 588 588 } … … 590 590 if (list->size != 9) { 591 591 printListInt(list); 592 psError( __func__,"Didn't decrement size properly to 9.");592 psError(PS_ERR_UNKNOWN, true,"Didn't decrement size properly to 9."); 593 593 return 1; 594 594 } … … 598 598 if (psListRemove(list,PS_LIST_UNKNOWN,NULL)) { 599 599 printListInt(list); 600 psError( __func__,"removed something for PS_LIST_UNKNOWN with data=NULL");600 psError(PS_ERR_UNKNOWN, true,"removed something for PS_LIST_UNKNOWN with data=NULL"); 601 601 return 1; 602 602 } … … 607 607 (psListGet(list,PS_LIST_HEAD) == data) ) { 608 608 printListInt(list); 609 psError( __func__,"Failed to remove PS_LIST_UNKNOWN @ PS_LIST_HEAD");609 psError(PS_ERR_UNKNOWN, true,"Failed to remove PS_LIST_UNKNOWN @ PS_LIST_HEAD"); 610 610 return 1; 611 611 } … … 613 613 if (list->size != 8) { 614 614 printListInt(list); 615 psError( __func__,"Didn't decrement size properly to 8.");615 psError(PS_ERR_UNKNOWN, true,"Didn't decrement size properly to 8."); 616 616 return 1; 617 617 } … … 621 621 (psListGet(list,PS_LIST_TAIL) == data) ) { 622 622 printListInt(list); 623 psError( __func__,"Failed to remove PS_LIST_UNKNOWN @ PS_LIST_TAIL");623 psError(PS_ERR_UNKNOWN, true,"Failed to remove PS_LIST_UNKNOWN @ PS_LIST_TAIL"); 624 624 return 1; 625 625 } … … 627 627 if (list->size != 7) { 628 628 printListInt(list); 629 psError( __func__,"Didn't decrement size properly to 7.");629 psError(PS_ERR_UNKNOWN, true,"Didn't decrement size properly to 7."); 630 630 return 1; 631 631 } … … 637 637 (psListGet(list,1) == data) ) { 638 638 printListInt(list); 639 psError( __func__,"Failed to remove PS_LIST_UNKNOWN @ which=1");639 psError(PS_ERR_UNKNOWN, true,"Failed to remove PS_LIST_UNKNOWN @ which=1"); 640 640 return 1; 641 641 } … … 643 643 if (list->size != 6) { 644 644 printListInt(list); 645 psError( __func__,"Didn't decrement size properly to 6.");645 psError(PS_ERR_UNKNOWN, true,"Didn't decrement size properly to 6."); 646 646 return 1; 647 647 } … … 651 651 if ( psListRemove(list,PS_LIST_UNKNOWN,data) ) { 652 652 printListInt(list); 653 psError( __func__,"removed something for PS_LIST_UNKNOWN with previously removed item");653 psError(PS_ERR_UNKNOWN, true,"removed something for PS_LIST_UNKNOWN with previously removed item"); 654 654 return 1; 655 655 } … … 666 666 (psListGet(list,PS_LIST_HEAD) == data) ) { 667 667 printListInt(list); 668 psError( __func__,"Failed to remove last element");668 psError(PS_ERR_UNKNOWN, true,"Failed to remove last element"); 669 669 return 1; 670 670 } … … 672 672 if (list->size != 0) { 673 673 printListInt(list); 674 psError( __func__,"Didn't remove all the elements.");674 psError(PS_ERR_UNKNOWN, true,"Didn't remove all the elements."); 675 675 return 1; 676 676 } … … 709 709 710 710 if (arr->n != 15 || list->size != 15) { 711 psError( __func__,"The created array didn't have the proper size");711 psError(PS_ERR_UNKNOWN, true,"The created array didn't have the proper size"); 712 712 return 1; 713 713 } 714 714 for (psS32 i=0;i<arr->n;i++) { 715 715 if (i != *(psS32*)arr->data[i]) { 716 psError( __func__,"Element %d of array is incorrect (%d).",716 psError(PS_ERR_UNKNOWN, true,"Element %d of array is incorrect (%d).", 717 717 i,*(psS32*)arr->data[i]); 718 718 return 1; 719 719 } 720 720 if (i != *(psS32*)psListGet(list,i)) { 721 psError( __func__,"Element %d of list is incorrect (%d).",721 psError(PS_ERR_UNKNOWN, true,"Element %d of list is incorrect (%d).", 722 722 i,*(psS32*)arr->data[i]); 723 723 return 1; 724 724 } 725 725 if (psMemGetRefCounter(arr->data[i]) != 2) { 726 psError( __func__,"Element %d had wrong reference count (%d).",726 psError(PS_ERR_UNKNOWN, true,"Element %d had wrong reference count (%d).", 727 727 i,psMemGetRefCounter(arr->data[i])); 728 728 return 1; … … 747 747 748 748 if (arr->n != 15 || list->size != 15) { 749 psError( __func__,"The created array didn't have the proper size");749 psError(PS_ERR_UNKNOWN, true,"The created array didn't have the proper size"); 750 750 return 1; 751 751 } 752 752 for (psS32 i=0;i<arr->n;i++) { 753 753 if (i != *(psS32*)arr->data[i]) { 754 psError( __func__,"Element %d of array is incorrect (%d).",754 psError(PS_ERR_UNKNOWN, true,"Element %d of array is incorrect (%d).", 755 755 i,*(psS32*)arr->data[i]); 756 756 return 1; 757 757 } 758 758 if (i != *(psS32*)psListGet(list,i)) { 759 psError( __func__,"Element %d of list is incorrect (%d).",759 psError(PS_ERR_UNKNOWN, true,"Element %d of list is incorrect (%d).", 760 760 i,*(psS32*)arr->data[i]); 761 761 return 1; 762 762 } 763 763 if (psMemGetRefCounter(arr->data[i]) != 2) { 764 psError( __func__,"Element %d had wrong reference count (%d).",764 psError(PS_ERR_UNKNOWN, true,"Element %d had wrong reference count (%d).", 765 765 i,psMemGetRefCounter(arr->data[i])); 766 766 return 1; … … 775 775 arr = psListToArray(NULL); 776 776 if (arr != NULL) { 777 psError( __func__,"psListToArray didn't return NULL when given NULL");777 psError(PS_ERR_UNKNOWN, true,"psListToArray didn't return NULL when given NULL"); 778 778 return 1; 779 779 } … … 781 781 list = psArrayToList(NULL); 782 782 if (list != NULL) { 783 psError( __func__,"psArrayToList didn't return NULL when given NULL");783 psError(PS_ERR_UNKNOWN, true,"psArrayToList didn't return NULL when given NULL"); 784 784 return 1; 785 785 } … … 790 790 list = psArrayToList(arr); 791 791 if (list == NULL) { 792 psError( __func__,"psArrayToList didn't create an empty list from an "792 psError(PS_ERR_UNKNOWN, true,"psArrayToList didn't create an empty list from an " 793 793 "empty array."); 794 794 return 1; … … 800 800 arr = psListToArray(list); 801 801 if (arr == NULL) { 802 psError( __func__,"psArrayToList didn't create an empty array from an "802 psError(PS_ERR_UNKNOWN, true,"psArrayToList didn't create an empty array from an " 803 803 "empty list."); 804 804 return 1; … … 853 853 psListSetIterator(list,PS_LIST_TAIL); 854 854 if (*(psS32*)psListGetCurrent(list) != 14) { 855 psError( __func__,"Didn't successfully move cursor to tail.");855 psError(PS_ERR_UNKNOWN, true,"Didn't successfully move cursor to tail."); 856 856 return 1; 857 857 } … … 860 860 psListSetIterator(list,PS_LIST_HEAD); 861 861 if (*(psS32*)psListGetCurrent(list) != 0) { 862 psError( __func__,"Didn't successfully move cursor to head.");862 psError(PS_ERR_UNKNOWN, true,"Didn't successfully move cursor to head."); 863 863 return 2; 864 864 } … … 867 867 psListSetIterator(list,PS_LIST_NEXT); 868 868 if (*(psS32*)psListGetCurrent(list) != 1) { 869 psError( __func__,"Didn't successfully move cursor to next.");869 psError(PS_ERR_UNKNOWN, true,"Didn't successfully move cursor to next."); 870 870 return 3; 871 871 } 872 872 psListSetIterator(list,PS_LIST_NEXT); 873 873 if (*(psS32*)psListGetCurrent(list) != 2) { 874 psError( __func__,"Didn't successfully move cursor to next twice.");874 psError(PS_ERR_UNKNOWN, true,"Didn't successfully move cursor to next twice."); 875 875 return 4; 876 876 } … … 879 879 psListSetIterator(list,PS_LIST_PREVIOUS); 880 880 if (*(psS32*)psListGetCurrent(list) != 1) { 881 psError( __func__,"Didn't successfully move cursor to previous.");881 psError(PS_ERR_UNKNOWN, true,"Didn't successfully move cursor to previous."); 882 882 return 5; 883 883 } 884 884 psListSetIterator(list,PS_LIST_PREVIOUS); 885 885 if (*(psS32*)psListGetCurrent(list) != 0) { 886 psError( __func__,"Didn't successfully move cursor to previous twice.");886 psError(PS_ERR_UNKNOWN, true,"Didn't successfully move cursor to previous twice."); 887 887 return 6; 888 888 } … … 893 893 psListSetIterator(list,PS_LIST_UNKNOWN); 894 894 if (*(psS32*)psListGetCurrent(list) != 1) { 895 psError( __func__,"PS_LIST_UNKNOWN moved cursor.");895 psError(PS_ERR_UNKNOWN, true,"PS_LIST_UNKNOWN moved cursor."); 896 896 return 7; 897 897 } 898 898 psListSetIterator(list,PS_LIST_CURRENT); 899 899 if (*(psS32*)psListGetCurrent(list) != 1) { 900 psError( __func__,"PS_LIST_CURRENT moved cursor.");900 psError(PS_ERR_UNKNOWN, true,"PS_LIST_CURRENT moved cursor."); 901 901 return 8; 902 902 } … … 904 904 // test psListGetPrevious/Next 905 905 if (*(psS32*)psListGetNext(list) != 2) { 906 psError( __func__,"psListGetNext didn't move cursor to next.");906 psError(PS_ERR_UNKNOWN, true,"psListGetNext didn't move cursor to next."); 907 907 return 9; 908 908 } 909 909 if (*(psS32*)psListGetNext(list) != 3) { 910 psError( __func__,"psListGetNext didn't move cursor to next.");910 psError(PS_ERR_UNKNOWN, true,"psListGetNext didn't move cursor to next."); 911 911 return 10; 912 912 } 913 913 if (*(psS32*)psListGetPrevious(list) != 2) { 914 psError( __func__,"psListGetPrevious didn't move cursor to previous.");914 psError(PS_ERR_UNKNOWN, true,"psListGetPrevious didn't move cursor to previous."); 915 915 return 11; 916 916 } 917 917 if (*(psS32*)psListGetPrevious(list) != 1) { 918 psError( __func__,"psListGetPrevious didn't move cursor to previous.");918 psError(PS_ERR_UNKNOWN, true,"psListGetPrevious didn't move cursor to previous."); 919 919 return 12; 920 920 } 921 921 if (*(psS32*)psListGetPrevious(list) != 0) { 922 psError( __func__,"psListGetPrevious didn't move cursor to previous..");922 psError(PS_ERR_UNKNOWN, true,"psListGetPrevious didn't move cursor to previous.."); 923 923 return 13; 924 924 } 925 925 if (psListGetPrevious(list) != NULL) { 926 psError( __func__,"psListGetPrevious moved cursor beyond head.");926 psError(PS_ERR_UNKNOWN, true,"psListGetPrevious moved cursor beyond head."); 927 927 return 14; 928 928 } … … 930 930 psListSetIterator(list,PS_LIST_TAIL); // works according to an above test 931 931 if (psListGetNext(list) != NULL) { 932 psError( __func__,"psListGetNext moved cursor beyond tail.");932 psError(PS_ERR_UNKNOWN, true,"psListGetNext moved cursor beyond tail."); 933 933 return 15; 934 934 } … … 959 959 psListAdd(list,PS_LIST_TAIL,data[lcv]); 960 960 if (psMemGetRefCounter(data[lcv]) != 2) { 961 psError( __func__,"Reference counter for data was not incremented");961 psError(PS_ERR_UNKNOWN, true,"Reference counter for data was not incremented"); 962 962 return 1; 963 963 } … … 969 969 */ 970 970 if (list->size != 15) { 971 psError( __func__,"List wasn't populated as expected?");971 psError(PS_ERR_UNKNOWN, true,"List wasn't populated as expected?"); 972 972 return 2; 973 973 } … … 989 989 for (psS32 i=0;i<15;i++) { 990 990 if (psMemGetRefCounter(data[i]) != 1) { 991 psError( __func__,"pslistFree didn't decrement the data item's reference counter");991 psError(PS_ERR_UNKNOWN, true,"pslistFree didn't decrement the data item's reference counter"); 992 992 return 3; 993 993 } … … 1039 1039 iter = psListGet(list,PS_LIST_NEXT)) { 1040 1040 if (*prevValue > *iter) { 1041 psError( __func__,"Hey, the list wasn't sorted!?");1041 psError(PS_ERR_UNKNOWN, true,"Hey, the list wasn't sorted!?"); 1042 1042 return 1; 1043 1043 } … … 1059 1059 iter = psListGet(list,PS_LIST_NEXT)) { 1060 1060 if (*prevValue < *iter) { 1061 psError( __func__,"Hey, the list wasn't sorted!?");1061 psError(PS_ERR_UNKNOWN, true,"Hey, the list wasn't sorted!?"); 1062 1062 return 1; 1063 1063 } … … 1105 1105 iter = psListGet(list,PS_LIST_NEXT)) { 1106 1106 if (*prev > *iter) { 1107 psError( __func__,"Hey, the list wasn't sorted!?");1107 psError(PS_ERR_UNKNOWN, true,"Hey, the list wasn't sorted!?"); 1108 1108 return 1; 1109 1109 } … … 1125 1125 iter = psListGet(list,PS_LIST_NEXT)) { 1126 1126 if (*prev < *iter) { 1127 psError( __func__,"Hey, the list wasn't sorted!?");1127 psError(PS_ERR_UNKNOWN, true,"Hey, the list wasn't sorted!?"); 1128 1128 return 1; 1129 1129 }
Note:
See TracChangeset
for help on using the changeset viewer.
