IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 3111


Ignore:
Timestamp:
Feb 2, 2005, 11:58:49 AM (21 years ago)
Author:
evanalst
Message:

Update test case for non-mutable lists.

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

Legend:

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

    r3108 r3111  
    66 *  @author Robert DeSonia, MHPCC
    77 *
    8  *  @version $Revision: 1.26 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2005-02-02 20:20:18 $
     8 *  @version $Revision: 1.27 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2005-02-02 21:58:48 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    185185    }
    186186
     187    // Verify error message is generate with non-mutable iterator
     188    psLogMsg(__func__,PS_LOG_INFO,"Non-mutable list should generate error message");
     189    currentIterator->mutable = false;
     190    if(psListAddAfter(currentIterator,data2)) {
     191        psError(PS_ERR_UNKNOWN,true,"psListAddAfter should have generated error for non-mutable list add");
     192        return 7;
     193    }
     194    currentIterator->mutable = true;
     195
    187196    psFree(data);
    188197    psFree(data1);
     
    256265    }
    257266
     267    // Verify error message is generate with non-mutable iterator
     268    psLogMsg(__func__,PS_LOG_INFO,"Non-mutable list should generate error message");
     269    currentIterator->mutable = false;
     270    if(psListAddBefore(currentIterator,data2)) {
     271        psError(PS_ERR_UNKNOWN,true,"psListAddBefore should have generated error for non-mutable list add");
     272        return 7;
     273    }
     274    currentIterator->mutable = true;
     275
    258276    psFree(data1);
    259277    psFree(data2);
     
    284302
    285303    //  1. list is NULL (error)
     304    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error for using NULL list.");
    286305    if (psListAdd(NULL,PS_LIST_HEAD,data)) {
    287306        psError(PS_ERR_UNKNOWN, true,"psListAdd was given a NULL list, but returned a true/success.");
     
    297316
    298317    //  2. data is NULL (error, list should not grow)
     318    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error msg to add NULL data");
    299319    if (psListAdd(list, PS_LIST_HEAD,NULL)) {
    300320        psError(PS_ERR_UNKNOWN, true,"psListAdd successfully added a NULL data item?");
     
    428448    *data = 7;
    429449    // Test requirment SDR-169
    430     if ( ! psListAdd(list,2,data) ) {
     450    if ( ! psListAdd(list,-2,data) ) {
    431451        psError(PS_ERR_UNKNOWN, true,"psListAdd failed to add data to 2 position.");
    432452        return 32;
    433453    }
     454
    434455    // Test requirment SDR-175
    435456    if (psMemGetRefCounter(data) != 2) {
     
    439460    psFree(data);
    440461    // verify that the size incremented
    441     if (list->size != 6  || *(psS32 *)list->head->next->next->data != 7) {
     462    if (list->size != 6  || *(psS32 *)list->tail->prev->data != 7) {
    442463        printListInt(list);
    443464        psError(PS_ERR_UNKNOWN, true,"psListAdd didn't insert to position #2.");
  • trunk/psLib/test/collections/verified/tst_psList.stderr

    r3108 r3111  
    1818<DATE><TIME>|<HOST>|I|testListAdd
    1919    psListAdd shall add an element to list
     20<DATE><TIME>|<HOST>|I|testListAdd
     21    Following should generate an error for using NULL list.
    2022<DATE><TIME>|<HOST>|E|psListAdd (psList.c:<LINENO>)
    2123    Specified psList reference is NULL.
     24<DATE><TIME>|<HOST>|I|testListAdd
     25    Following should generate an error msg to add NULL data
    2226<DATE><TIME>|<HOST>|E|psListAdd (psList.c:<LINENO>)
    2327    Specified data item is NULL.
     
    2529    Following should error with invalid insert location
    2630<DATE><TIME>|<HOST>|E|psListIteratorSet (psList.c:<LINENO>)
    27     Specified location, -7, is invalid.
     31    Specified location, -6, is invalid.
    2832<DATE><TIME>|<HOST>|I|testListAdd
    2933    Following should be a warning.
     
    133137<DATE><TIME>|<HOST>|E|psListAddAfter (psList.c:<LINENO>)
    134138    Specified iterator is NULL.
     139<DATE><TIME>|<HOST>|I|testListAddAfter
     140    Non-mutable list should generate error message
     141<DATE><TIME>|<HOST>|E|psListAddAfter (psList.c:<LINENO>)
     142    Specified iterator indicates list is non-mutable.
    135143
    136144---> TESTPOINT PASSED (psList{psListAddAfter} | tst_psList.c)
     
    150158<DATE><TIME>|<HOST>|E|psListAddBefore (psList.c:<LINENO>)
    151159    Specified iterator is NULL.
     160<DATE><TIME>|<HOST>|I|testListAddBefore
     161    Non-mutable list should generate error message
     162<DATE><TIME>|<HOST>|E|psListAddBefore (psList.c:<LINENO>)
     163    Specified iterator indicates list is non-mutable.
    152164
    153165---> TESTPOINT PASSED (psList{psListAddBefore} | tst_psList.c)
Note: See TracChangeset for help on using the changeset viewer.