IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 3066


Ignore:
Timestamp:
Jan 19, 2005, 3:48:38 PM (22 years ago)
Author:
evanalst
Message:

Update tests for psListRemove and psListRemoveData.

Location:
trunk/psLib/test/collections
Files:
2 edited

Legend:

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

    r3063 r3066  
    66 *  @author Robert DeSonia, MHPCC
    77 *
    8  *  @version $Revision: 1.22 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2005-01-20 00:30:05 $
     8 *  @version $Revision: 1.23 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2005-01-20 01:48:38 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    623623
    624624    // 2. which is PS_LIST_HEAD (remove first element of list)
    625     data = psListGet(list,PS_LIST_HEAD);
     625    psS32* data1 = (psS32 *)psListGet(list,PS_LIST_HEAD);
     626    psMemIncrRefCounter(data1);
     627    // Test requirement SDR-172, SDR-173
    626628    if ( (! psListRemove(list,PS_LIST_HEAD)) ||
    627629            (psListGet(list,PS_LIST_HEAD) == data) ) {
     
    636638        return 1;
    637639    }
     640    // Test requirement SDR-176
     641    if (psMemGetRefCounter(data1) != 1) {
     642        psError(PS_ERR_UNKNOWN, true,"psListRemove didn't decrement the data reference count.");
     643        return 20;
     644    }
     645    psMemDecrRefCounter(data1);
    638646
    639647    // 3. which is PS_LIST_TAIL (remove last element of list)
    640648    data = psListGet(list,PS_LIST_TAIL);
     649    // Test requirement SDR-173
    641650    if ( (! psListRemove(list,PS_LIST_TAIL)) ||
    642651            (psListGet(list,PS_LIST_TAIL) == data) ) {
     
    662671    // 7. which is PS_LIST_UNKNOWN and data=[head,tail,other list items]
    663672    data = psListGet(list,PS_LIST_HEAD);
     673    // Test requirement SDR-762
    664674    if ( (! psListRemoveData(list,data)) ||
    665675            (psListGet(list,PS_LIST_HEAD) == data) ) {
     
    675685    }
    676686
    677     data = psListGet(list,PS_LIST_TAIL);
    678     if ( (!psListRemoveData(list,data)) ||
    679             (psListGet(list,PS_LIST_TAIL) == data) ) {
     687    psS32* data2 = psListGet(list,PS_LIST_TAIL);
     688    psMemIncrRefCounter(data2);
     689    if ( (!psListRemoveData(list,data2)) ||
     690            (psListGet(list,PS_LIST_TAIL) == data2) ) {
    680691        printListInt(list);
    681692        psError(PS_ERR_UNKNOWN, true,"Failed to remove PS_LIST_UNKNOWN @ PS_LIST_TAIL");
     
    688699        return 1;
    689700    }
     701    // Test requirement SDR-176
     702    if (psMemGetRefCounter(data2) != 1) {
     703        psError(PS_ERR_UNKNOWN, true,"psListRemoveData didn't decrement the data reference count.");
     704        return 20;
     705    }
     706    psMemDecrRefCounter(data2);
    690707
    691708    data = psListGet(list,1);
     
    705722    // 8. data!=NULL and data!=any element in list
    706723    psLogMsg(__func__,PS_LOG_INFO,"Next message should be an error");
     724    // Test requirement SDR-764
    707725    if ( psListRemoveData(list,data) ) {
    708726        printListInt(list);
     
    735753        psError(PS_ERR_UNKNOWN, true,"Didn't remove all the elements.");
    736754        return 1;
     755    }
     756
     757    psLogMsg(__func__,PS_LOG_INFO,"NULL list in psListRemoveData should generate error message.");
     758    if(psListRemoveData(NULL,data)) {
     759        psError(PS_ERR_UNKNOWN,true,"psListRemoveData should have generated an error with NULL list");
     760        return 2;
    737761    }
    738762
  • trunk/psLib/test/collections/verified/tst_psList.stderr

    r3064 r3066  
    7272<DATE><TIME>|<HOST>|E|psListRemoveData (psList.c:<LINENO>)
    7373    Specified data item is not found in the psList.
     74<DATE><TIME>|<HOST>|I|testListRemove
     75    NULL list in psListRemoveData should generate error message.
     76<DATE><TIME>|<HOST>|E|psListRemoveData (psList.c:<LINENO>)
     77    Specified psList reference is NULL.
    7478
    7579---> TESTPOINT PASSED (psList{psListRemove} | tst_psList.c)
Note: See TracChangeset for help on using the changeset viewer.