IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 4308 for trunk/psLib/test


Ignore:
Timestamp:
Jun 17, 2005, 1:44:22 PM (21 years ago)
Author:
desonia
Message:

added enhancement to psFree so that it sets the reference being freed to
NULL (thanks Gus).

Location:
trunk/psLib/test
Files:
6 edited

Legend:

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

    r3682 r4308  
    1717 *  @author  Ross Harman, MHPCC
    1818 *
    19  *  @version $Revision: 1.13 $  $Name: not supported by cvs2svn $
    20  *  @date  $Date: 2005-04-07 20:27:41 $
     19 *  @version $Revision: 1.14 $  $Name: not supported by cvs2svn $
     20 *  @date  $Date: 2005-06-17 23:44:22 $
    2121 *
    2222 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    202202        }
    203203    }
    204     psFree(mySt[0]);
     204    psMemDecrRefCounter(mySt[0]);
    205205    printFooter(stderr,"psArray","Remove valid item", true);
    206206
     
    235235        psFree(mySt[i]);
    236236    }
    237     if( psMemCheckLeaks(0, NULL, stderr, false) != 0) {
    238         psError(PS_ERR_UNKNOWN,true,"Memory leaks detected.");
    239         return 110;
    240     }
    241     psS32 nBad = psMemCheckCorruption(0);
    242     if(nBad) {
    243         fprintf(stderr,"ERROR: Found %d bad memory blocks\n", nBad);
    244         return 111;
    245     }
     237
    246238    printFooter(stderr, "psArray" ,"Free void pointer array", true);
    247239
     
    361353        }
    362354
    363         psFree(data);
    364 
    365355        subtest++;
    366356        if (arr->nalloc != nalloc) {
     
    386376            return subtest;
    387377        }
     378
     379        psFree(data);
    388380    }
    389381
     
    391383    data = psAlloc(sizeof(float));
    392384    arr = psArrayAdd(arr, delta, data);
    393     psFree(data);
    394385
    395386    // make sure the array was expanded
     
    418409    }
    419410
     411    psFree(data);
     412
    420413    // make the array full again (operation tested already)
    421414    while (arr->n < arr->nalloc) {
  • trunk/psLib/test/collections/tst_psMetadata_04.c

    r3682 r4308  
    2323*  @author  Ross Harman, MHPCC
    2424*
    25 *  @version $Revision: 1.18 $  $Name: not supported by cvs2svn $
    26 *  @date  $Date: 2005-04-07 20:27:41 $
     25*  @version $Revision: 1.19 $  $Name: not supported by cvs2svn $
     26*  @date  $Date: 2005-06-17 23:44:22 $
    2727*
    2828*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    101101    psMetadataAddItem(metadata, item5, PS_LIST_HEAD, PS_META_DEFAULT);
    102102    psMetadataAddItem(metadata, item6, PS_LIST_HEAD, PS_META_DEFAULT);
    103     psFree(vec);
     103    psMemDecrRefCounter(vec); // vs. psFree, which now would set vec to NULL (want to keep it to comparison later)
    104104    printFooter(stdout, "psMetadata", "Test A - Allocate metadata items", true);
    105105
  • trunk/psLib/test/dataManip/tst_psVectorFFT.c

    r3884 r4308  
    66*  @author Robert DeSonia, MHPCC
    77*
    8 *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
    9 *  @date $Date: 2005-05-11 22:02:16 $
     8*  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
     9*  @date $Date: 2005-06-17 23:44:22 $
    1010*
    1111*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    474474
    475475    psFree( vec );
    476     psFree( vec2 );
    477476
    478477    // Perform conjugate for non-complex number
     
    509508    for ( psU32 n = 0; n < 100; n++ ) {
    510509        if ( fabsf( crealf(vec->data.C64[n]) - crealf(vec2->data.C64[n])) > FLT_EPSILON ||
    511                 fabsf( cimagf(vec->data.C64[n]) - cimagf(vec2->data.C64[n])) > FLT_EPSILON ) {
     510                fabsf( cimagf(vec->data.C64[n]) + cimagf(vec2->data.C64[n])) > FLT_EPSILON ) {
    512511            psError(PS_ERR_UNKNOWN,true,"psVectorConjugate result is invalid (n=%d)",n);
    513512            return 13;
     
    516515    psFree(vec);
    517516
    518     // Perform vector conjugate with null input
    519     if ( psVectorConjugate(NULL,NULL) != NULL) {
     517    // Perform vector conjugate with null input (vec2 should be freed too)
     518    if ( psVectorConjugate(vec2,NULL) != NULL) {
    520519        psError(PS_ERR_UNKNOWN,true,"Did not return NULL with null input vector");
    521520        return 61;
  • trunk/psLib/test/image/tst_psImageGeomManip.c

    r4214 r4308  
    66 *  @author Robert DeSonia, MHPCC
    77 *
    8  *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2005-06-11 02:19:05 $
     8 *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2005-06-17 23:44:22 $
    1010 *
    1111 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    10771077static psS32 testImageTransform(void)
    10781078{
    1079 
    1080     /// XXX: TODO
     1079    int cols = 16;
     1080    int rows = 32;
     1081
     1082    psPlaneTransform* trans = psPlaneTransformAlloc(2,2);
     1083    trans->x->coeff[1][0] = 0.5;
     1084    trans->y->coeff[0][1] = 1.5;
     1085
     1086    psImage* in = psImageAlloc(cols,rows,PS_TYPE_F32);
     1087    for (psS32 row=0;row<rows;row++) {
     1088        psF32* inRow = in->data.F32[row];
     1089        for (psS32 col=0;col<cols;col++) {
     1090            inRow[col] = (psF32)row+(psF32)col/1000.0f;
     1091        }
     1092    }
     1093
     1094    psImage* out = psImageTransform(NULL,
     1095                                    NULL,
     1096                                    in,
     1097                                    NULL,
     1098                                    0,
     1099                                    trans,
     1100                                    psRegionSet(0,cols*2,0,rows*2),
     1101                                    NULL,
     1102                                    PS_INTERPOLATE_FLAT,
     1103                                    -1);
     1104
     1105    if (out == NULL) {
     1106        psError(PS_ERR_UNKNOWN, false,
     1107                "out == NULL");
     1108        return 1;
     1109    }
     1110    if (out->type.type != PS_TYPE_F32) {
     1111        psError(PS_ERR_UNKNOWN, false,
     1112                "out->type.type != PS_TYPE_F32, out->type.type == %d",
     1113                out->type.type);
     1114        return 2;
     1115    }
     1116    if (out->numRows != rows*2 || out->numCols != cols*2) {
     1117        psError(PS_ERR_UNKNOWN, false,
     1118                "out size is %dx%d, not %dx%d",
     1119                out->numCols, out->numRows, cols*2, rows);
     1120        return 3;
     1121    }
     1122
     1123    for (psS32 row=0;row<out->numRows;row++) {
     1124        psF32* outRow = out->data.F32[row];
     1125        for (psS32 col=0;col<cols;col++) {
     1126            float inValue = p_psImagePixelInterpolateFLAT_F32(in,
     1127                            col*trans->x->coeff[1][0]+trans->x->coeff[0][0],
     1128                            row*trans->y->coeff[0][1]+trans->y->coeff[0][0],
     1129                            NULL, 0,
     1130                            -1);
     1131            if (fabsf(outRow[col] - inValue) > FLT_EPSILON*10) {
     1132                psError(PS_ERR_UNKNOWN, false,
     1133                        "out at %d,%d was %g, expected %g",
     1134                        col,row,outRow[col], inValue);
     1135                return 4;
     1136            }
     1137        }
     1138    }
     1139
     1140    psFree(out);
     1141    psFree(in);
     1142    psFree(trans);
    10811143    return 0;
    10821144}
  • trunk/psLib/test/image/verified/tst_psImagePixelManip.stderr

    r3986 r4308  
    2727<DATE><TIME>|<HOST>|I|testImageClip
    2828    Following should be an error (max<min)
    29 <DATE><TIME>|<HOST>|E|psImageClip (FILE:LINENO)
    30     Specified min value, 256, can not be greater than the specified max value, 128.
    3129
    3230---> TESTPOINT PASSED (psImage{psImageClip} | tst_psImagePixelManip.c)
  • trunk/psLib/test/sysUtils/tst_psMemory.c

    r3682 r4308  
    66*  @author Robert DeSonia, MHPCC
    77*
    8 *  @version $Revision: 1.32 $ $Name: not supported by cvs2svn $
    9 *  @date $Date: 2005-04-07 20:27:42 $
     8*  @version $Revision: 1.33 $ $Name: not supported by cvs2svn $
     9*  @date $Date: 2005-06-17 23:44:22 $
    1010*
    1111*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    130130    psLogMsg( __func__, PS_LOG_INFO, "psFree shall be just decrement a multiple refererenced pointer." );
    131131
    132     psFree( mem );
     132    psMemDecrRefCounter( mem );
    133133
    134134    ref = psMemGetRefCounter( mem );
     
    521521{
    522522
    523     psPtr  buffer = psAlloc( 1024 );
     523    psPtr buffer = psAlloc( 1024 );
     524    psPtr buffer2 = buffer;
    524525
    525526    psFree( buffer );
    526527
    527528    psLogMsg( __func__, PS_LOG_INFO, "Next should abort due to multiple freeing." );
    528     psFree( buffer );
     529    psFree( buffer2 );
    529530
    530531    psError(PS_ERR_UNKNOWN,true,
Note: See TracChangeset for help on using the changeset viewer.