IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 9, 2004, 10:56:23 AM (22 years ago)
Author:
desonia
Message:

Added check of reference count increment after psListAdd calls in testListAdd().

File:
1 edited

Legend:

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

    r948 r950  
    66 *  @author Robert DeSonia, MHPCC
    77 *
    8  *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2004-06-09 19:51:08 $
     8 *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2004-06-09 20:56:23 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    165165    *data = 2;
    166166    list = psListAdd(list,data,PS_LIST_HEAD);
     167    if (psMemGetRefCounter(data) != 2) {
     168        psError(__func__,"psListAdd didn't increment the data reference count.");
     169        return 20;
     170    }
    167171    psFree(data);
    168172    // verify that the size incremented
     
    181185    *data = 3;
    182186    list = psListAdd(list,data,PS_LIST_TAIL);
     187    if (psMemGetRefCounter(data) != 2) {
     188        psError(__func__,"psListAdd didn't increment the data reference count.");
     189        return 20;
     190    }
    183191    psFree(data);
    184192    // verify that the size incremented
     
    206214    psLogMsg(__func__,PS_LOG_INFO,"Following should warn with invalid insert location");
    207215    list = psListAdd(list,data,-10);
     216    if (psMemGetRefCounter(data) != 2) {
     217        psError(__func__,"psListAdd didn't increment the data reference count.");
     218        return 20;
     219    }
    208220    psFree(data);
    209221    // verify that the size incremented
     
    218230    *data = 5;
    219231    list = psListAdd(list,data,1);
     232    if (psMemGetRefCounter(data) != 2) {
     233        psError(__func__,"psListAdd didn't increment the data reference count.");
     234        return 20;
     235    }
    220236    psFree(data);
    221237    // verify that the size incremented
     
    229245    *data = 6;
    230246    list = psListAdd(list,data,4);
     247    if (psMemGetRefCounter(data) != 2) {
     248        psError(__func__,"psListAdd didn't increment the data reference count.");
     249        return 20;
     250    }
    231251    psFree(data);
    232252    // verify that the size incremented
     
    240260    *data = 7;
    241261    list = psListAdd(list,data,2);
     262    if (psMemGetRefCounter(data) != 2) {
     263        psError(__func__,"psListAdd didn't increment the data reference count.");
     264        return 20;
     265    }
    242266    psFree(data);
    243267    // verify that the size incremented
     
    252276    psLogMsg(__func__,PS_LOG_INFO,"Following should be a warning.");
    253277    list = psListAdd(list,data,9);
     278    if (psMemGetRefCounter(data) != 2) {
     279        psError(__func__,"psListAdd didn't increment the data reference count.");
     280        return 20;
     281    }
    254282    psFree(data);
    255283    // verify that the size incremented
Note: See TracChangeset for help on using the changeset viewer.