IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 3, 2004, 3:05:00 PM (22 years ago)
Author:
desonia
Message:

changed the psError signature to match SDRS. Also made misc. cleanups as
I was combing the files.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/test/collections/tst_psList.c

    r2204 r2273  
    66 *  @author Robert DeSonia, MHPCC
    77 *
    8  *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2004-10-27 00:57:33 $
     8 *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2004-11-04 01:05:00 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4444
    4545    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");
    4747        return 1;
    4848    }
     
    6666    list = psListAlloc(NULL);
    6767    if (list == NULL) {
    68         psError(__func__,"psListAlloc failed to return a list.");
     68        psError(PS_ERR_UNKNOWN, true,"psListAlloc failed to return a list.");
    6969        return 1;
    7070    }
    7171
    7272    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.");
    7474        return 2;
    7575    }
    7676
    7777    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.");
    7979        return 3;
    8080    }
     
    8484    list = psListAlloc(data);
    8585    if (list == NULL) {
    86         psError(__func__,"psListAlloc failed to return a list.");
     86        psError(PS_ERR_UNKNOWN, true,"psListAlloc failed to return a list.");
    8787        return 4;
    8888    }
    8989
    9090    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.");
    9292        return 5;
    9393    }
    9494
    9595    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.");
    9797        return 6;
    9898    }
    9999
    100100    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.");
    102102        return 7;
    103103    }
     
    105105    ref = psMemGetRefCounter(data);
    106106    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);
    108108        return 8;
    109109    }
     
    139139    //  1. list is NULL (error)
    140140    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.");
    142142        return 1;
    143143    }
     
    146146    psFree(data);
    147147    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.");
    149149        return 2;
    150150    }
     
    152152    //  2. data is NULL (error, list should not grow)
    153153    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?");
    155155        return 40;
    156156    }
    157157    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.");
    159159        return 3;
    160160    }
     
    164164    *data = 2;
    165165    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.");
    167167        return 21;
    168168    }
    169169
    170170    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.");
    172172        return 20;
    173173    }
     
    176176    // verify that the size incremented
    177177    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");
    179179        return 4;
    180180    }
     
    182182    // verify that the head is the inserted data item
    183183    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.");
    185185        return 5;
    186186    }
     
    189189    *data = 3;
    190190    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.");
    192192        return 21;
    193193    }
    194194
    195195    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.");
    197197        return 22;
    198198    }
     
    200200    // verify that the size incremented
    201201    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");
    203203        return 6;
    204204    }
     
    206206    // verify that the head is still the same
    207207    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.");
    209209        return 7;
    210210    }
     
    212212    // verify that the tail is the data item inserted
    213213    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.");
    215215        return 8;
    216216    }
     
    223223
    224224    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?");
    226226        return 30;
    227227    }
    228228    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.");
    230230        return 24;
    231231    }
     
    234234    if (list->size != 3) {
    235235        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.");
    237237        return 9;
    238238    }
     
    243243
    244244    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.");
    246246        return 30;
    247247    }
    248248
    249249    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.");
    251251        return 25;
    252252    }
     
    255255    if (list->size != 4 || *(psS32*)list->head->next->data != 5) {
    256256        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.");
    258258        return 10;
    259259    }
     
    262262    *data = 6;
    263263    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.");
    265265        return 31;
    266266    }
    267267    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.");
    269269        return 26;
    270270    }
     
    273273    if (list->size != 5  || *(psS32 *)list->head->next->next->next->data != 6) {
    274274        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.");
    276276        return 50;
    277277    }
     
    280280    *data = 7;
    281281    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.");
    283283        return 32;
    284284    }
    285285    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.");
    287287        return 28;
    288288    }
     
    291291    if (list->size != 6  || *(psS32 *)list->head->next->next->data != 7) {
    292292        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.");
    294294        return 11;
    295295    }
     
    300300
    301301    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?");
    303303        return 30;
    304304    }
    305305
    306306    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.");
    308308        return 29;
    309309    }
     
    314314    if (list->size != 7) {
    315315        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.");
    317317        return 12;
    318318    }
     
    366366    psLogMsg(__func__,PS_LOG_INFO,"Following should be an error");
    367367    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.");
    369369        return 1;
    370370    };
     
    394394    data = (psS32*)psListGet(list,3);
    395395    if (data == NULL || *data != 3) {
    396         psError(__func__,"psListGet failed with which=3");
     396        psError(PS_ERR_UNKNOWN, true,"psListGet failed with which=3");
    397397        return 2;
    398398    }
    399399    data = (psS32*)psListGet(list,1);
    400400    if (data == NULL || *data != 1) {
    401         psError(__func__,"psListGet failed with which=1");
     401        psError(PS_ERR_UNKNOWN, true,"psListGet failed with which=1");
    402402        return 3;
    403403    }
     
    406406    data = (psS32*)psListGet(list,5);
    407407    if (data != NULL) {
    408         psError(__func__,"psListGet failed with which=5");
     408        psError(PS_ERR_UNKNOWN, true,"psListGet failed with which=5");
    409409        return 4;
    410410    }
    411411    data = (psS32*)psListGet(list,4);
    412412    if (data != NULL) {
    413         psError(__func__,"psListGet failed with which=4");
     413        psError(PS_ERR_UNKNOWN, true,"psListGet failed with which=4");
    414414        return 5;
    415415    }
     
    418418    data = (psS32*)psListGet(list,PS_LIST_HEAD);
    419419    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");
    421421        return 6;
    422422    }
     
    425425    data = (psS32*)psListGet(list,PS_LIST_NEXT);
    426426    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");
    428428        return 7;
    429429    }
     
    432432    data = (psS32*)psListGet(list,PS_LIST_TAIL);
    433433    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");
    435435        return 8;
    436436    }
     
    439439    data = (psS32*)psListGet(list,PS_LIST_PREVIOUS);
    440440    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");
    442442        return 9;
    443443    }
     
    473473    psLogMsg(__func__,PS_LOG_INFO,"Following should be an error");
    474474    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.");
    476476        return 1;
    477477    };
     
    493493            (psListGet(list,PS_LIST_HEAD) == data) ) {
    494494        printListInt(list);
    495         psError(__func__,"Failed to remove PS_LIST_HEAD");
     495        psError(PS_ERR_UNKNOWN, true,"Failed to remove PS_LIST_HEAD");
    496496        return 1;
    497497    }
     
    499499    if (list->size != 14) {
    500500        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.");
    502502        return 1;
    503503    }
     
    508508            (psListGet(list,PS_LIST_TAIL) == data) ) {
    509509        printListInt(list);
    510         psError(__func__,"Failed to remove PS_LIST_TAIL");
     510        psError(PS_ERR_UNKNOWN, true,"Failed to remove PS_LIST_TAIL");
    511511        return 1;
    512512    }
     
    514514    if (list->size != 13) {
    515515        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.");
    517517        return 1;
    518518    }
     
    522522    if (! psListRemove(list,PS_LIST_NEXT,NULL)) {
    523523        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");
    525525        return 1;
    526526    }
     
    528528    if (list->size != 12) {
    529529        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.");
    531531        return 1;
    532532    }
     
    536536    if (psListRemove(list,PS_LIST_NEXT,NULL)) {
    537537        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");
    539539        return 1;
    540540    }
     
    545545            ( psListGet(list,3) == data) ) {
    546546        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");
    548548        return 1;
    549549    }
     
    551551    if (list->size != 11) {
    552552        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.");
    554554        return 1;
    555555    }
     
    560560    if (psListRemove(list,PS_LIST_PREVIOUS,NULL)) {
    561561        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");
    563563        return 1;
    564564    }
     
    569569            (psListGet(list,9) == data) ) {
    570570        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");
    572572        return 1;
    573573    }
     
    575575    if (list->size != 10) {
    576576        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.");
    578578        return 1;
    579579    }
     
    584584            ( psListGet(list,1) == data) ) {
    585585        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");
    587587        return 1;
    588588    }
     
    590590    if (list->size != 9) {
    591591        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.");
    593593        return 1;
    594594    }
     
    598598    if (psListRemove(list,PS_LIST_UNKNOWN,NULL)) {
    599599        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");
    601601        return 1;
    602602    }
     
    607607            (psListGet(list,PS_LIST_HEAD) == data) ) {
    608608        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");
    610610        return 1;
    611611    }
     
    613613    if (list->size != 8) {
    614614        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.");
    616616        return 1;
    617617    }
     
    621621            (psListGet(list,PS_LIST_TAIL) == data) ) {
    622622        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");
    624624        return 1;
    625625    }
     
    627627    if (list->size != 7) {
    628628        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.");
    630630        return 1;
    631631    }
     
    637637            (psListGet(list,1) == data) ) {
    638638        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");
    640640        return 1;
    641641    }
     
    643643    if (list->size != 6) {
    644644        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.");
    646646        return 1;
    647647    }
     
    651651    if ( psListRemove(list,PS_LIST_UNKNOWN,data) ) {
    652652        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");
    654654        return 1;
    655655    }
     
    666666            (psListGet(list,PS_LIST_HEAD) == data) ) {
    667667        printListInt(list);
    668         psError(__func__,"Failed to remove last element");
     668        psError(PS_ERR_UNKNOWN, true,"Failed to remove last element");
    669669        return 1;
    670670    }
     
    672672    if (list->size != 0) {
    673673        printListInt(list);
    674         psError(__func__,"Didn't remove all the elements.");
     674        psError(PS_ERR_UNKNOWN, true,"Didn't remove all the elements.");
    675675        return 1;
    676676    }
     
    709709
    710710    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");
    712712        return 1;
    713713    }
    714714    for (psS32 i=0;i<arr->n;i++) {
    715715        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).",
    717717                    i,*(psS32*)arr->data[i]);
    718718            return 1;
    719719        }
    720720        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).",
    722722                    i,*(psS32*)arr->data[i]);
    723723            return 1;
    724724        }
    725725        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).",
    727727                    i,psMemGetRefCounter(arr->data[i]));
    728728            return 1;
     
    747747
    748748    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");
    750750        return 1;
    751751    }
    752752    for (psS32 i=0;i<arr->n;i++) {
    753753        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).",
    755755                    i,*(psS32*)arr->data[i]);
    756756            return 1;
    757757        }
    758758        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).",
    760760                    i,*(psS32*)arr->data[i]);
    761761            return 1;
    762762        }
    763763        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).",
    765765                    i,psMemGetRefCounter(arr->data[i]));
    766766            return 1;
     
    775775    arr = psListToArray(NULL);
    776776    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");
    778778        return 1;
    779779    }
     
    781781    list = psArrayToList(NULL);
    782782    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");
    784784        return 1;
    785785    }
     
    790790    list = psArrayToList(arr);
    791791    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 "
    793793                "empty array.");
    794794        return 1;
     
    800800    arr = psListToArray(list);
    801801    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 "
    803803                "empty list.");
    804804        return 1;
     
    853853    psListSetIterator(list,PS_LIST_TAIL);
    854854    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.");
    856856        return 1;
    857857    }
     
    860860    psListSetIterator(list,PS_LIST_HEAD);
    861861    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.");
    863863        return 2;
    864864    }
     
    867867    psListSetIterator(list,PS_LIST_NEXT);
    868868    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.");
    870870        return 3;
    871871    }
    872872    psListSetIterator(list,PS_LIST_NEXT);
    873873    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.");
    875875        return 4;
    876876    }
     
    879879    psListSetIterator(list,PS_LIST_PREVIOUS);
    880880    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.");
    882882        return 5;
    883883    }
    884884    psListSetIterator(list,PS_LIST_PREVIOUS);
    885885    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.");
    887887        return 6;
    888888    }
     
    893893    psListSetIterator(list,PS_LIST_UNKNOWN);
    894894    if (*(psS32*)psListGetCurrent(list) != 1) {
    895         psError(__func__,"PS_LIST_UNKNOWN moved cursor.");
     895        psError(PS_ERR_UNKNOWN, true,"PS_LIST_UNKNOWN moved cursor.");
    896896        return 7;
    897897    }
    898898    psListSetIterator(list,PS_LIST_CURRENT);
    899899    if (*(psS32*)psListGetCurrent(list) != 1) {
    900         psError(__func__,"PS_LIST_CURRENT moved cursor.");
     900        psError(PS_ERR_UNKNOWN, true,"PS_LIST_CURRENT moved cursor.");
    901901        return 8;
    902902    }
     
    904904    // test psListGetPrevious/Next
    905905    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.");
    907907        return 9;
    908908    }
    909909    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.");
    911911        return 10;
    912912    }
    913913    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.");
    915915        return 11;
    916916    }
    917917    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.");
    919919        return 12;
    920920    }
    921921    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..");
    923923        return 13;
    924924    }
    925925    if (psListGetPrevious(list) != NULL) {
    926         psError(__func__,"psListGetPrevious moved cursor beyond head.");
     926        psError(PS_ERR_UNKNOWN, true,"psListGetPrevious moved cursor beyond head.");
    927927        return 14;
    928928    }
     
    930930    psListSetIterator(list,PS_LIST_TAIL); // works according to an above test
    931931    if (psListGetNext(list) != NULL) {
    932         psError(__func__,"psListGetNext moved cursor beyond tail.");
     932        psError(PS_ERR_UNKNOWN, true,"psListGetNext moved cursor beyond tail.");
    933933        return 15;
    934934    }
     
    959959        psListAdd(list,PS_LIST_TAIL,data[lcv]);
    960960        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");
    962962            return 1;
    963963        }
     
    969969    */
    970970    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?");
    972972        return 2;
    973973    }
     
    989989    for (psS32 i=0;i<15;i++) {
    990990        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");
    992992            return 3;
    993993        }
     
    10391039            iter = psListGet(list,PS_LIST_NEXT)) {
    10401040        if (*prevValue > *iter) {
    1041             psError(__func__,"Hey, the list wasn't sorted!?");
     1041            psError(PS_ERR_UNKNOWN, true,"Hey, the list wasn't sorted!?");
    10421042            return 1;
    10431043        }
     
    10591059            iter = psListGet(list,PS_LIST_NEXT)) {
    10601060        if (*prevValue < *iter) {
    1061             psError(__func__,"Hey, the list wasn't sorted!?");
     1061            psError(PS_ERR_UNKNOWN, true,"Hey, the list wasn't sorted!?");
    10621062            return 1;
    10631063        }
     
    11051105            iter = psListGet(list,PS_LIST_NEXT)) {
    11061106        if (*prev > *iter) {
    1107             psError(__func__,"Hey, the list wasn't sorted!?");
     1107            psError(PS_ERR_UNKNOWN, true,"Hey, the list wasn't sorted!?");
    11081108            return 1;
    11091109        }
     
    11251125            iter = psListGet(list,PS_LIST_NEXT)) {
    11261126        if (*prev < *iter) {
    1127             psError(__func__,"Hey, the list wasn't sorted!?");
     1127            psError(PS_ERR_UNKNOWN, true,"Hey, the list wasn't sorted!?");
    11281128            return 1;
    11291129        }
Note: See TracChangeset for help on using the changeset viewer.