IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 10, 2007, 11:09:31 AM (19 years ago)
Author:
gusciora
Message:

This is a fairly large checkin. Most of the files were modified so they have
the same basic structure and format for testing: reporting errors, checking
memory leaks etc. Several bug fixes are included as well.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/test/sys/tap_psMemory.c

    r12513 r12781  
    33*  @brief Contains the tests for psMemory.[ch]
    44*
    5 *
    65*  @author Robert DeSonia, MHPCC
    76*
    8 *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
    9 *  @date $Date: 2007-03-20 03:57:25 $
     7*  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
     8*  @date $Date: 2007-04-10 21:09:31 $
    109*
    1110*  XXXX: Several tests fail with an Abort and are commented out.
     
    4241    psLogSetFormat("HLNM");
    4342    psLogSetLevel(PS_LOG_INFO);
    44     plan_tests(10);
    45 
    46     void TPFreeReferencedMemory( void );
    47     if (1) {
    48         TPFreeReferencedMemory();
    49     }
    50 
    51     void TPOutOfMemory( void );
     43    plan_tests(46);
     44
     45    // TPFreeReferencedMemory()
     46    {
     47        psMemId id = psMemGetId();
     48        psS32 *mem  = ( psS32* ) psAlloc( 100 * sizeof( psS32 ) );
     49        psS32 ref = psMemGetRefCounter( mem );
     50        ok(ref == 1, "buffer reference count %d.", ref );
     51        skip_start ( ref != 1, 3, "buffer reference count %d.", ref );
     52        psMemIncrRefCounter(mem);
     53        psMemIncrRefCounter(mem);
     54        psMemIncrRefCounter(mem);
     55
     56        ref = psMemGetRefCounter( mem );
     57        ok(ref == 4, "buffer reference count was %d.", ref );
     58        skip_start ( ref != 4, 2, "buffer reference count was %d.", ref );
     59
     60        psMemDecrRefCounter( mem );
     61        psMemDecrRefCounter( mem );
     62
     63        ref = psMemGetRefCounter( mem );
     64        ok(ref == 2, "Found buffer reference count to be %d.", ref );
     65        skip_start ( ref != 2, 1, "Found buffer reference count to be %d.", ref );
     66
     67        psMemDecrRefCounter( mem );
     68        ref = psMemGetRefCounter( mem );
     69        ok(ref == 1, "Found buffer reference count to be %d.", ref );
     70        skip_end();
     71        skip_end();
     72        skip_end();
     73        psFree(mem);
     74        ok(!psMemCheckLeaks(id, NULL, NULL, false), "no memory leaks");
     75    }
     76
     77
     78    // Upon requesting more memory than is available, psalloc shall call
     79    // the psMemExhaustedCallback.
    5280    // XXXX: Skipping TPOutOfMemory() because of test abort failure
    5381    if (0) {
    54         TPOutOfMemory();
    55     }
    56 
    57     void TPReallocOutOfMemory( void );
     82        psMemId id = psMemGetId();
     83        psS32 *mem[ 100 ];
     84        psMemExhaustedCallback cb;
     85        for ( psS32 lcv = 0; lcv < 100; lcv++ ) {
     86            mem[ lcv ] = NULL;
     87        }
     88        exhaustedCallbackCalled = 0;
     89        cb = psMemExhaustedCallbackSet( TPOutOfMemoryExhaustedCallback );
     90        #ifdef COMMENTED_OUT
     91        // Don't include since intentionally aborts
     92        for ( psS32 lcv = 0; lcv < 100; lcv++ ) {
     93            mem[ lcv ] = ( psS32* ) psAlloc( SIZE_MAX/2 - 1000 );
     94        }
     95        psMemExhaustedCallbackSet( cb );
     96        ok(exhaustedCallbackCalled != 0,
     97             "Called psAlloc with HUGE memory requirement and survived!");
     98        for ( psS32 lcv = 0; lcv < 100; lcv++ ) {
     99            psFree( mem[ lcv ] );
     100        }
     101        #endif
     102        ok(!psMemCheckLeaks(id, NULL, NULL, false), "no memory leaks");
     103    }
     104
     105
     106
     107    // Bug/Task #562 regression test.  Upon requesting more memory than is available,
     108    // psRealloc shall call the psMemExhaustedCallback.
    58109    // XXXX: Skipping TPReallocOutOfMemory() because of test abort failure
    59110    if (0) {
    60         TPReallocOutOfMemory();
    61     }
    62 
    63     void TPCheckBufferPositive( void );
    64     if (1) {
    65         TPCheckBufferPositive();
    66     }
    67 
    68     void TPrealloc( void );
    69     if (1) {
    70         TPrealloc();
    71     }
    72 
    73     void TPallocCallback( void );
    74     if (1) {
    75         TPallocCallback();
    76     }
    77 
    78     void TPcheckLeaks( void );
     111        psMemId id = psMemGetId();
     112        psS32 *mem[ 100 ];
     113        psMemExhaustedCallback cb;
     114        for ( psS32 lcv = 0; lcv < 100; lcv++ ) {
     115            mem[ lcv ] = NULL;
     116        }
     117        exhaustedCallbackCalled = 0;
     118        cb = psMemExhaustedCallbackSet( TPOutOfMemoryExhaustedCallback );
     119        for ( psS32 lcv = 0; lcv < 100; lcv++ ) {
     120            mem[ lcv ] = ( psS32* ) psAlloc( 10 );
     121        }
     122        for ( psS32 lcv = 0; lcv < 100; lcv++ ) {
     123            mem[ lcv ] = ( psS32* ) psRealloc( mem[ lcv ], SIZE_MAX/2 - 1000 );
     124        }
     125        psMemExhaustedCallbackSet( cb );
     126        ok(exhaustedCallbackCalled != 0,
     127             "Called psRealloc with HUGE memory requirement and survived in %s!", __func__ );
     128        for ( psS32 lcv = 0; lcv < 100; lcv++ ) {
     129            psFree( mem[ lcv ] );
     130        }
     131        ok(!psMemCheckLeaks(id, NULL, NULL, false), "no memory leaks");
     132    }
     133
     134
     135    // psAlloc shall allocate memory blocks writeable by caller.
     136    {
     137        psMemId id = psMemGetId();
     138        const psS32 size = 100;
     139        psS32 *mem = ( psS32* ) psAlloc( size * sizeof( psS32 ) );
     140        ok(mem != NULL, "psAlloc returned non-NULL value" );
     141        for ( psS32 index = 0;index < size;index++ ) {
     142            mem[ index ] = index;
     143        }
     144        psS32 failed = 0;
     145        for ( psS32 index = 0;index < size;index++ ) {
     146            if ( mem[ index ] != index ) {
     147                failed++;
     148            }
     149        }
     150        ok(failed == 0, "mem legit" );
     151        psFree( mem );
     152        ok(!psMemCheckLeaks(id, NULL, NULL, false), "no memory leaks");
     153    }
     154
     155
     156    // psRealloc shall increase/decrease memory buffer while preserving contents
     157    {
     158        psMemId id = psMemGetId();
     159        const psS32 initialSize = 100;
     160        // allocate buffer with known values.
     161        psS32 *mem1 = ( psS32* ) psAlloc( initialSize * sizeof( psS32 ) );
     162        psS32 *mem2 = ( psS32* ) psAlloc( initialSize * sizeof( psS32 ) );
     163        psS32 *mem3 = ( psS32* ) psAlloc( initialSize * sizeof( psS32 ) );
     164        for ( psS32 lcv = 0;lcv < initialSize;lcv++ ) {
     165            mem1[lcv] = mem2[lcv] = mem3[lcv] = lcv;
     166        }
     167        psMemCheckCorruption(stderr, false);
     168        // realloc to 2x
     169        mem1 = ( psS32* ) psRealloc( mem1, 2 * initialSize * sizeof( psS32 ) );
     170        mem2 = ( psS32* ) psRealloc( mem2, 2 * initialSize * sizeof( psS32 ) );
     171        mem3 = ( psS32* ) psRealloc( mem3, 2 * initialSize * sizeof( psS32 ) );
     172        // check values of initial block
     173        int error = 0;
     174        for ( psS32 i = 0;i < initialSize;i++ ) {
     175            if ( mem1[ i ] != i || mem2[ i ] != i || mem3[ i ] != i ) {
     176                error = 1;
     177                break;
     178            }
     179        }
     180        ok(error==0, "Realloc preserve the contents with expanding buffer");
     181        psMemCheckCorruption(stderr, false);
     182        // realloc to 1/2 initial value.
     183        mem1 = ( psS32* ) psRealloc( mem1, ( initialSize / 2 ) * sizeof( psS32 ) );
     184        mem2 = ( psS32* ) psRealloc( mem2, ( initialSize / 2 ) * sizeof( psS32 ) );
     185        mem3 = ( psS32* ) psRealloc( mem3, ( initialSize / 2 ) * sizeof( psS32 ) );
     186        // check values of initial block
     187        error = 0;
     188        for ( psS32 i = 0;i < initialSize / 2;i++ ) {
     189            if ( mem1[ i ] != i || mem2[ i ] != i || mem3[ i ] != i ) {
     190                error = 1;
     191                break;
     192            }
     193        }
     194        ok(error==0, "Realloc preserved the contents with shrinking buffer");
     195        psFree( mem1 );
     196        psFree( mem2 );
     197        psFree( mem3 );
     198        ok(!psMemCheckLeaks(id, NULL, NULL, false), "no memory leaks");
     199    }
     200
     201
     202    // TPallocCallback()
     203    {
     204        psMemId id = psMemGetId();
     205        psS32 currentId = psMemGetId();
     206        const psS32 initialSize = 100;
     207        psS32 mark;
     208        allocCallbackCalled = 0;
     209        freeCallbackCalled = 0;
     210        psMemAllocCallbackSet( memAllocCallback );
     211        psMemFreeCallbackSet( memFreeCallback );
     212        psMemAllocCallbackSetID( currentId + 1 );
     213        psMemFreeCallbackSetID( currentId + 1 );
     214        // allocate buffer with known values.
     215        psS32 *mem1 = ( psS32* ) psAlloc( initialSize * sizeof( psS32 ) );
     216        psS32 *mem2 = ( psS32* ) psAlloc( initialSize * sizeof( psS32 ) );
     217        psS32 *mem3 = ( psS32* ) psAlloc( initialSize * sizeof( psS32 ) );
     218        psFree(mem1);
     219        psFree(mem2);
     220        psFree(mem3);
     221        ok(allocCallbackCalled == 2 && freeCallbackCalled == 2,
     222            "alloc/free callbacks called the proper number of times" );
     223        allocCallbackCalled = 0;
     224        freeCallbackCalled = 0;
     225        mark = psMemGetId();
     226        mem1 = ( psS32* ) psAlloc( initialSize * sizeof( psS32 ) );
     227        psMemAllocCallbackSetID( mark );
     228        mem1 = ( psS32* ) psRealloc( mem1, initialSize * 2 * sizeof( psS32 ) );
     229        psFree( mem1 );
     230        ok(allocCallbackCalled == 2,
     231             "realloc callbacks were called the proper number of times" );
     232        ok(!psMemCheckLeaks(id, NULL, NULL, false), "no memory leaks");
     233    }
     234
     235
     236    // TPcheckLeaks()
    79237    // XXXX: Skipping TPcheckLeaks() because of test abort failure
    80238    if (0) {
    81         TPcheckLeaks();
    82     }
     239        const psS32 numBuffers = 5;
     240        psS32* buffers[ 5 ];
     241        psS32 lcv;
     242        psS32 currentId = psMemGetId();
     243        psMemBlock** blks;
     244        psS32 nLeaks = 0;
     245        psS32 lineMark = 0;
     246
     247        for ( lcv = 0;lcv < numBuffers;lcv++ ) {
     248            lineMark = __LINE__ + 1;
     249            buffers[ lcv ] = psAlloc( sizeof( psS32 ) );
     250        }
     251        for ( lcv = 1;lcv < numBuffers;lcv++ ) {
     252            psFree( buffers[ lcv ] );
     253        }
     254        nLeaks = psMemCheckLeaks( currentId, &blks, stderr, false );
     255        ok(nLeaks == 1, "psMemCheckLeaks found %d leaks", nLeaks );
     256        ok(blks[ 0 ] ->lineno == lineMark,
     257             "psMemCheckLeaks found a leak other than the expected one (line %d vs %d)", lineMark, blks[ 0 ] ->lineno );
     258        psFree( buffers[ 0 ] );
     259        psFree( blks );
     260        psMemCheckLeaks(currentId,NULL,stderr, false);
     261        for ( lcv = 0;lcv < numBuffers;lcv++ ) {
     262            lineMark = __LINE__ + 1;
     263            buffers[ lcv ] = psAlloc( sizeof( psS32 ) );
     264        }
     265        for ( lcv = 0;lcv < numBuffers - 1;lcv++ ) {
     266            psFree( buffers[ lcv ] );
     267        }
     268        nLeaks = psMemCheckLeaks( currentId, &blks, stderr, false );
     269        ok(nLeaks == 1, "psMemCheckLeaks found %d leaks.", nLeaks );
     270        ok(blks[ 0 ] ->lineno == lineMark, "psMemCheckLeaks found leaks");
     271        psFree( buffers[ 4 ] );
     272        psFree( blks );
     273        for ( lcv = 0;lcv < numBuffers;lcv++ ) {
     274            lineMark = __LINE__ + 1;
     275            buffers[ lcv ] = psAlloc( sizeof( psS32 ) );
     276        }
     277        for ( lcv = 0;lcv < numBuffers;lcv++ ) {
     278            if ( lcv % 2 == 0 ) {
     279                psFree( buffers[ lcv ] );
     280            }
     281        }
     282        nLeaks = psMemCheckLeaks( currentId, &blks, stderr, false );
     283        ok(nLeaks == 2, "psMemCheckLeaks found %d leaks.", nLeaks);
     284        ok(blks[ 0 ] ->lineno == lineMark,
     285             "psMemCheckLeaks found a leak other than the expected." );
     286        psFree(blks);
     287        psFree(buffers[1]);
     288        psFree(buffers[3]);
     289    }
     290
    83291
    84292    void TPmultipleFree( void );
     
    87295        TPmultipleFree();
    88296    }
    89 }
    90 
    91 // Testpoint #449, psAlloc shall allocate memory blocks writeable by caller.
    92 void TPCheckBufferPositive( void )
    93 {
    94 //    diag("TPCheckBufferPositive");
    95 
    96     psS32 * mem;
    97     const psS32 size = 100;
    98     psS32 failed = 0;
    99 
    100     mem = ( psS32* ) psAlloc( size * sizeof( psS32 ) );
    101     ok ( mem != NULL, "psAlloc returned non-NULL value" );
    102 
    103     for ( psS32 index = 0;index < size;index++ ) {
    104         mem[ index ] = index;
    105     }
    106 
    107     for ( psS32 index = 0;index < size;index++ ) {
    108         if ( mem[ index ] != index ) {
    109             failed++;
    110         }
    111     }
    112     ok( failed == 0, "mem legit" );
    113 
    114     psFree( mem );
    115 }
    116 
    117 void TPFreeReferencedMemory( void )
    118 {
    119     // diag("TPFreeReferencedMemory");
    120 
    121     // create memory
    122     psS32 * mem;
    123     psS32 ref = 0;
    124 
    125     mem = ( psS32* ) psAlloc( 100 * sizeof( psS32 ) );
    126 
    127     ref = psMemGetRefCounter( mem );
    128     ok ( ref == 1, "buffer reference count %d.", ref );
    129     skip_start ( ref != 1, 3, "buffer reference count %d.", ref );
    130 
    131     psMemIncrRefCounter( mem );
    132     psMemIncrRefCounter( mem );
    133     psMemIncrRefCounter( mem );
    134 
    135     ref = psMemGetRefCounter( mem );
    136     ok ( ref == 4, "buffer reference count was %d.", ref );
    137     skip_start ( ref != 4, 2, "buffer reference count was %d.", ref );
    138 
    139     psMemDecrRefCounter( mem );
    140     psMemDecrRefCounter( mem );
    141 
    142     ref = psMemGetRefCounter( mem );
    143     ok ( ref == 2, "Found buffer reference count to be %d.", ref );
    144     skip_start ( ref != 2, 1, "Found buffer reference count to be %d.", ref );
    145 
    146     psMemDecrRefCounter( mem );
    147 
    148     ref = psMemGetRefCounter( mem );
    149     ok ( ref == 1, "Found buffer reference count to be %d.", ref );
    150 
    151     skip_end();
    152     skip_end();
    153     skip_end();
    154 
    155     psFree( mem );
    156 }
    157 
    158 // Bug/Task #562 regression test.  Upon requesting more memory than is available, psRealloc shall call
    159 // the psMemExhaustedCallback.
    160 void TPReallocOutOfMemory( void )
    161 {
    162     // diag("TPReallocOutOfMemory");
    163 
    164     psS32 * mem[ 100 ];
    165     psMemExhaustedCallback cb;
    166 
    167     for ( psS32 lcv = 0; lcv < 100; lcv++ ) {
    168         mem[ lcv ] = NULL;
    169     }
    170 
    171     exhaustedCallbackCalled = 0;
    172 
    173     cb = psMemExhaustedCallbackSet( TPOutOfMemoryExhaustedCallback );
    174 
    175     for ( psS32 lcv = 0; lcv < 100; lcv++ ) {
    176         mem[ lcv ] = ( psS32* ) psAlloc( 10 );
    177     }
    178 
    179     for ( psS32 lcv = 0; lcv < 100; lcv++ ) {
    180         mem[ lcv ] = ( psS32* ) psRealloc( mem[ lcv ], SIZE_MAX/2 - 1000 );
    181     }
    182 
    183     psMemExhaustedCallbackSet( cb );
    184 
    185     ok ( exhaustedCallbackCalled != 0,
    186          "Called psRealloc with HUGE memory requirement and survived in %s!", __func__ );
    187 
    188     for ( psS32 lcv = 0; lcv < 100; lcv++ ) {
    189         psFree( mem[ lcv ] );
    190     }
    191 }
    192 
    193 
    194 // Testpoint #450,  Upon requesting more memory than is available, psalloc shall call
    195 // the psMemExhaustedCallback.
    196 void TPOutOfMemory( void )
    197 {
    198     // diag("TPOutOfMemory");
    199 
    200     psS32 * mem[ 100 ];
    201     psMemExhaustedCallback cb;
    202 
    203     for ( psS32 lcv = 0; lcv < 100; lcv++ ) {
    204         mem[ lcv ] = NULL;
    205     }
    206 
    207     exhaustedCallbackCalled = 0;
    208     cb = psMemExhaustedCallbackSet( TPOutOfMemoryExhaustedCallback );
    209 
    210     #ifdef COMMENTED_OUT
    211     // Don't include since intentionally aborts
    212 
    213     for ( psS32 lcv = 0; lcv < 100; lcv++ ) {
    214         mem[ lcv ] = ( psS32* ) psAlloc( SIZE_MAX/2 - 1000 );
    215     }
    216 
    217     psMemExhaustedCallbackSet( cb );
    218 
    219     ok ( exhaustedCallbackCalled != 0,
    220          "Called psAlloc with HUGE memory requirement and survived!");
    221 
    222     for ( psS32 lcv = 0; lcv < 100; lcv++ ) {
    223         psFree( mem[ lcv ] );
    224     }
    225     #endif
    226 }
    227 
    228 
    229 // Testpoint #451,  psRealloc shall increase/decrease memory buffer while preserving contents
    230 void TPrealloc( void )
    231 {
    232     // diag("TPrealloc");
    233 
    234     psS32 * mem1;
    235     psS32* mem2;
    236     psS32* mem3;
    237     const psS32 initialSize = 100;
    238 
    239     // allocate buffer with known values.
    240     mem1 = ( psS32* ) psAlloc( initialSize * sizeof( psS32 ) );
    241     mem2 = ( psS32* ) psAlloc( initialSize * sizeof( psS32 ) );
    242     mem3 = ( psS32* ) psAlloc( initialSize * sizeof( psS32 ) );
    243     for ( psS32 lcv = 0;lcv < initialSize;lcv++ ) {
    244         mem1[ lcv ] = mem2[ lcv ] = mem3[ lcv ] = lcv;
    245     }
    246 
    247     psMemCheckCorruption(stderr, false);
    248 
    249     // realloc to 2x
    250     mem1 = ( psS32* ) psRealloc( mem1, 2 * initialSize * sizeof( psS32 ) );
    251     mem2 = ( psS32* ) psRealloc( mem2, 2 * initialSize * sizeof( psS32 ) );
    252     mem3 = ( psS32* ) psRealloc( mem3, 2 * initialSize * sizeof( psS32 ) );
    253 
    254     // check values of initial block
    255     int error = 0;
    256     for ( psS32 i = 0;i < initialSize;i++ ) {
    257         if ( mem1[ i ] != i || mem2[ i ] != i || mem3[ i ] != i ) {
    258             error = 1;
    259             break;
    260         }
    261     }
    262     ok(error==0, "Realloc preserve the contents with expanding buffer");
    263 
    264     psMemCheckCorruption(stderr, false);
    265 
    266     // realloc to 1/2 initial value.
    267     mem1 = ( psS32* ) psRealloc( mem1, ( initialSize / 2 ) * sizeof( psS32 ) );
    268     mem2 = ( psS32* ) psRealloc( mem2, ( initialSize / 2 ) * sizeof( psS32 ) );
    269     mem3 = ( psS32* ) psRealloc( mem3, ( initialSize / 2 ) * sizeof( psS32 ) );
    270 
    271     // check values of initial block
    272     error = 0;
    273     for ( psS32 i = 0;i < initialSize / 2;i++ ) {
    274         if ( mem1[ i ] != i || mem2[ i ] != i || mem3[ i ] != i ) {
    275             error = 1;
    276             break;
    277         }
    278     }
    279     ok(error==0, "Realloc preserved the contents with shrinking buffer");
    280 
    281     psFree( mem1 );
    282     psFree( mem2 );
    283     psFree( mem3 );
    284 }
    285 
    286 
    287 void TPallocCallback( void )
    288 {
    289     // diag("TPallocCallback");
    290 
    291     psS32 * mem1;
    292     psS32* mem2;
    293     psS32* mem3;
    294     psS32 currentId = psMemGetId();
    295     const psS32 initialSize = 100;
    296     psS32 mark;
    297 
    298     allocCallbackCalled = 0;
    299     freeCallbackCalled = 0;
    300     psMemAllocCallbackSet( memAllocCallback );
    301     psMemFreeCallbackSet( memFreeCallback );
    302 
    303     psMemAllocCallbackSetID( currentId + 1 );
    304     psMemFreeCallbackSetID( currentId + 1 );
    305 
    306     // allocate buffer with known values.
    307     mem1 = ( psS32* ) psAlloc( initialSize * sizeof( psS32 ) );
    308     mem2 = ( psS32* ) psAlloc( initialSize * sizeof( psS32 ) );
    309     mem3 = ( psS32* ) psAlloc( initialSize * sizeof( psS32 ) );
    310 
    311     psFree( mem1 );
    312     psFree( mem2 );
    313     psFree( mem3 );
    314 
    315     ok( allocCallbackCalled == 2 && freeCallbackCalled == 2,
    316         "alloc/free callbacks called the proper number of times" );
    317     skip_start( allocCallbackCalled != 2 || freeCallbackCalled != 2,
    318                 1, "alloc/free callbacks called the proper number of times" );
    319 
    320     allocCallbackCalled = 0;
    321     freeCallbackCalled = 0;
    322 
    323     mark = psMemGetId();
    324 
    325     mem1 = ( psS32* ) psAlloc( initialSize * sizeof( psS32 ) );
    326 
    327     psMemAllocCallbackSetID( mark );
    328 
    329     mem1 = ( psS32* ) psRealloc( mem1, initialSize * 2 * sizeof( psS32 ) );
    330 
    331     psFree( mem1 );
    332 
    333     ok ( allocCallbackCalled == 2,
    334          "realloc callbacks were called the proper number of times" );
    335 
    336     skip_end();
    337 }
    338 
    339 
    340 void TPcheckLeaks( void )
    341 {
    342     const psS32 numBuffers = 5;
    343     psS32* buffers[ 5 ];
    344     psS32 lcv;
    345     psS32 currentId = psMemGetId();
    346     psMemBlock** blks;
    347     psS32 nLeaks = 0;
    348     psS32 lineMark = 0;
    349 
    350     for ( lcv = 0;lcv < numBuffers;lcv++ ) {
    351         lineMark = __LINE__ + 1;
    352         buffers[ lcv ] = psAlloc( sizeof( psS32 ) );
    353     }
    354 
    355     for ( lcv = 1;lcv < numBuffers;lcv++ ) {
    356         psFree( buffers[ lcv ] );
    357     }
    358 
    359     nLeaks = psMemCheckLeaks( currentId, &blks, stderr, false );
    360 
    361     ok ( nLeaks == 1, "psMemCheckLeaks found %d leaks", nLeaks );
    362     skip_start ( nLeaks != 1, 5, "psMemCheckLeaks found %d leaks", nLeaks );
    363 
    364     ok ( blks[ 0 ] ->lineno == lineMark,
    365          "psMemCheckLeaks found a leak other than the expected one (line %d vs %d)", lineMark, blks[ 0 ] ->lineno );
    366     skip_start ( blks[ 0 ] ->lineno != lineMark,
    367                  4,"psMemCheckLeaks found a leak other than the expected one (line %d vs %d)", lineMark, blks[ 0 ] ->lineno );
    368 
    369     psFree( buffers[ 0 ] );
    370     psFree( blks );
    371 
    372     psMemCheckLeaks(currentId,NULL,stderr, false);
    373 
    374     for ( lcv = 0;lcv < numBuffers;lcv++ ) {
    375         lineMark = __LINE__ + 1;
    376         buffers[ lcv ] = psAlloc( sizeof( psS32 ) );
    377     }
    378 
    379     for ( lcv = 0;lcv < numBuffers - 1;lcv++ ) {
    380         psFree( buffers[ lcv ] );
    381     }
    382 
    383     nLeaks = psMemCheckLeaks( currentId, &blks, stderr, false );
    384 
    385     ok ( nLeaks == 1, "psMemCheckLeaks found %d leaks.", nLeaks );
    386     skip_start ( nLeaks != 1, 3, "psMemCheckLeaks found %d leaks.", nLeaks );
    387 
    388     ok ( blks[ 0 ] ->lineno == lineMark, "psMemCheckLeaks found leaks");
    389     skip_start ( blks[ 0 ] ->lineno==lineMark,2,"psMemCheckLeaks found leaks");
    390 
    391     psFree( buffers[ 4 ] );
    392     psFree( blks );
    393 
    394     for ( lcv = 0;lcv < numBuffers;lcv++ ) {
    395         lineMark = __LINE__ + 1;
    396         buffers[ lcv ] = psAlloc( sizeof( psS32 ) );
    397     }
    398 
    399     for ( lcv = 0;lcv < numBuffers;lcv++ ) {
    400         if ( lcv % 2 == 0 ) {
    401             psFree( buffers[ lcv ] );
    402         }
    403     }
    404 
    405     nLeaks = psMemCheckLeaks( currentId, &blks, stderr, false );
    406 
    407     ok ( nLeaks == 2, "psMemCheckLeaks found %d leaks.", nLeaks);
    408     skip_start ( nLeaks != 2, 1, "psMemCheckLeaks found %d leaks.", nLeaks);
    409 
    410     ok ( blks[ 0 ] ->lineno == lineMark,
    411          "psMemCheckLeaks found a leak other than the expected." );
    412 
    413     skip_end();
    414     skip_end();
    415     skip_end();
    416     skip_end();
    417     skip_end();
    418 
    419     psFree( blks );
    420     psFree( buffers[ 1 ] );
    421     psFree( buffers[ 3 ] );
     297
     298//HERE
     299    // memCheckTypes()
     300    if (1) {
     301        psMemId id = psMemGetId();
     302        psArray *negative = psArrayAlloc(2);
     303        psMetadata *neg = psMetadataAlloc();
     304
     305        psArray *array = psArrayAlloc(100);
     306        int okay = psMemCheckType(PS_DATA_ARRAY,array);
     307        if (!okay) {
     308            psFree(array);
     309        }
     310        ok(okay, "psMemCheckArray in memCheckType");
     311
     312        ok(!psMemCheckType(PS_DATA_ARRAY, neg), "psMemCheckType with metadata input");
     313        psFree(array);
     314
     315        psBitSet *bits;
     316        bits = psBitSetAlloc(100);
     317        okay = psMemCheckType(PS_DATA_BITSET, bits);
     318        if (!okay )
     319            psFree(bits);
     320        ok(okay, "psMemCheckBitSet in memCheckType");
     321        ok(!psMemCheckType(PS_DATA_BITSET, negative), "psMemCheckType on psArray");
     322        psFree(bits);
     323
     324        psCube *cube;
     325        cube = psCubeAlloc();
     326        okay = psMemCheckType(PS_DATA_CUBE, cube);
     327        if (!okay )
     328            psFree(cube);
     329        ok(okay, "psMemCheckCube in memCheckType");
     330        psFree(cube);
     331
     332        psFits *fits;
     333        fits = psFitsOpen("test.fits","w");
     334        psImage* img = psImageAlloc(16,16,PS_TYPE_F32);
     335        psFitsWriteImage(fits,NULL,img,1,NULL);
     336        psFree(img);
     337        okay = psMemCheckType(PS_DATA_FITS, fits);
     338        if (!okay )
     339            psFree(fits);
     340        ok(okay, "psMemCheckFits in memCheckType");
     341        psFitsClose(fits);
     342
     343        psHash *hash;
     344        hash = psHashAlloc(100);
     345        okay = psMemCheckType(PS_DATA_HASH, hash);
     346        if (!okay )
     347            psFree(hash);
     348        ok(okay, "psMemCheckHash in memCheckType");
     349        psFree(hash);
     350
     351        psHistogram *histogram;
     352        histogram = psHistogramAlloc(1.1, 2.2, 2);
     353        okay = psMemCheckType(PS_DATA_HISTOGRAM, histogram);
     354        if (!okay )
     355            psFree(histogram);
     356        ok(okay, "psMemCheckHistogram in memCheckType");
     357        psFree(histogram);
     358
     359        psImage *image;
     360        image = psImageAlloc(5, 5, PS_TYPE_F32);
     361        okay = psMemCheckType(PS_DATA_IMAGE, image);
     362        if (!okay )
     363            psFree(image);
     364        ok(okay, "psMemCheckImage in memCheckType");
     365        psFree(image);
     366
     367        psKernel *kernel;
     368        kernel = psKernelAlloc(0, 1, 0, 1);
     369        okay = psMemCheckType(PS_DATA_KERNEL, kernel);
     370        if (!okay )
     371            psFree(kernel);
     372        ok(okay, "psMemCheckKernel in memCheckType");
     373        psFree(kernel);
     374
     375        psList *list;
     376        list = psListAlloc(NULL);
     377        okay = psMemCheckType(PS_DATA_LIST, list);
     378        if (!okay )
     379            psFree(list);
     380        ok(okay, "psMemCheckList in memCheckType");
     381        psFree(list);
     382
     383        psLookupTable *lookup;
     384        char *file = "tableF32.dat";
     385        char *format = "\%f \%lf \%d \%ld";
     386        lookup = psLookupTableAlloc(file, format, 10);
     387        okay = psMemCheckType(PS_DATA_LOOKUPTABLE, lookup);
     388        if (!okay )
     389            psFree(lookup);
     390        ok(okay, "psMemCheckLookupTable in memCheckType");
     391        psFree(lookup);
     392
     393        psMetadata *metadata;
     394        metadata = psMetadataAlloc();
     395        okay = psMemCheckType(PS_DATA_METADATA, metadata);
     396        if (!okay )
     397            psFree(metadata);
     398        ok(okay, "psMemCheckMetadata in memCheckType");
     399        psFree(metadata);
     400
     401        psMetadataItem *metaItem;
     402        metaItem = psMetadataItemAlloc("name", PS_DATA_S32, "COMMENT", 1);
     403        okay = psMemCheckType(PS_DATA_METADATAITEM, metaItem);
     404        if (!okay )
     405            psFree(metaItem);
     406        ok(okay, "psMemCheckMetadataItem in memCheckType");
     407        psFree(metaItem);
     408
     409        psMinimization *min;
     410        min = psMinimizationAlloc(3, 0.1);
     411        okay = psMemCheckType(PS_DATA_MINIMIZATION, min);
     412        if (!okay )
     413            psFree(min);
     414        ok(okay, "psMemCheckMinimization in memCheckType");
     415        psFree(min);
     416
     417        psPixels *pixels;
     418        pixels = psPixelsAlloc(100);
     419        okay = psMemCheckType(PS_DATA_PIXELS, pixels);
     420        if (!okay )
     421            psFree(pixels);
     422        ok(okay, "psMemCheckPixels in memCheckType");
     423        psFree(pixels);
     424
     425        psPlane *plane;
     426        plane = psPlaneAlloc();
     427        okay = psMemCheckType(PS_DATA_PLANE, plane);
     428        if (!okay )
     429            psFree(plane);
     430        ok(okay, "psMemCheckPlane in memCheckType.");
     431        psFree(plane);
     432
     433        psPlaneDistort *planeDistort;
     434        planeDistort = psPlaneDistortAlloc(1, 1, 1, 1);
     435        okay =  psMemCheckType(PS_DATA_PLANEDISTORT, planeDistort);
     436        if (!okay )
     437            psFree(planeDistort);
     438        ok(okay, "psMemCheckPlaneDistort in memCheckType.");
     439        psFree(planeDistort);
     440
     441        psPlaneTransform *planeTransform;
     442        planeTransform = psPlaneTransformAlloc(1, 1);
     443        okay = psMemCheckType(PS_DATA_PLANETRANSFORM, planeTransform);
     444        if (!okay )
     445            psFree(planeTransform);
     446        ok(okay, "psMemCheckPlaneTransform in memCheckType");
     447        psFree(planeTransform);
     448   
     449        psPolynomial1D *poly1;
     450        poly1 = psPolynomial1DAlloc(PS_POLYNOMIAL_ORD, 2);
     451        okay = psMemCheckType(PS_DATA_POLYNOMIAL1D, poly1);
     452        if (!okay )
     453            psFree(poly1);
     454        ok(okay, "psMemCheckPolynomial1D in memCheckType");
     455        psFree(poly1);
     456   
     457        psPolynomial2D *poly2;
     458        poly2 = psPolynomial2DAlloc(PS_POLYNOMIAL_ORD, 2, 1);
     459        okay = psMemCheckType(PS_DATA_POLYNOMIAL2D, poly2);
     460        if (!okay )
     461            psFree(poly2);
     462        ok(okay, "psMemCheckPolynomial2D in memCheckType");
     463        psFree(poly2);
     464   
     465        psPolynomial3D *poly3;
     466        poly3 = psPolynomial3DAlloc(PS_POLYNOMIAL_ORD, 2, 1, 1);
     467        okay = psMemCheckType(PS_DATA_POLYNOMIAL3D, poly3);
     468        if (!okay )
     469            psFree(poly3);
     470        ok(okay, "psMemCheckPolynomial3D in memCheckType");
     471        psFree(poly3);
     472   
     473        psPolynomial4D *poly4;
     474        poly4 = psPolynomial4DAlloc(PS_POLYNOMIAL_ORD, 2, 1, 2, 1);
     475        okay = psMemCheckType(PS_DATA_POLYNOMIAL4D, poly4);
     476        if (!okay )
     477            psFree(poly4);
     478        ok(okay, "psMemCheckPolynomial4D in memCheckType");
     479        psFree(poly4);
     480   
     481        psProjection *proj;
     482        proj = psProjectionAlloc(1, 1, 2.1, 2.1, PS_PROJ_TAN);
     483        okay = psMemCheckType(PS_DATA_PROJECTION, proj);
     484        if (!okay )
     485            psFree(proj);
     486        ok(okay, "psMemCheckProjection in memCheckType.");
     487        psFree(proj);
     488   
     489        psScalar *scalar;
     490        psF64 f64 = 1.1;
     491        scalar = psScalarAlloc(f64, PS_TYPE_F64);
     492        okay = psMemCheckType(PS_DATA_SCALAR, scalar);
     493        if (!okay )
     494            psFree(scalar);
     495        ok(okay, "psMemCheckScalar in memCheckType");
     496        psFree(scalar);
     497   
     498        psSphere *sphere;
     499        sphere = psSphereAlloc();
     500        okay = psMemCheckType(PS_DATA_SPHERE, sphere);
     501        if (!okay )
     502            psFree(sphere);
     503        ok(okay, "psMemCheckSphere in memCheckType");
     504        psFree(sphere);
     505   
     506        psSphereRot *sphereRot;
     507        sphereRot = psSphereRotAlloc(0, 0, 20);
     508        okay = psMemCheckType(PS_DATA_SPHEREROT, sphereRot);
     509        if (!okay )
     510            psFree(sphereRot);
     511        ok(okay, "psMemCheckSphereRot in memCheckType");
     512        psFree(sphereRot);
     513   
     514        psSpline1D *spline;
     515        spline = psSpline1DAlloc(2, 1, 0, 2);
     516        okay = psMemCheckType(PS_DATA_SPLINE1D, spline);
     517        if (!okay )
     518            psFree(spline);
     519        ok(okay, "psMemCheckSpline1D in memCheckType");
     520        psFree(spline);
     521   
     522        psStats *stats;
     523        stats = psStatsAlloc(PS_STAT_MAX);
     524        okay = psMemCheckType(PS_DATA_STATS, stats);
     525        if (!okay )
     526            psFree(stats);
     527        ok(okay, "psMemCheckStats in memCheckType");
     528        psFree(stats);
     529   
     530        psTime *time;
     531        time = psTimeAlloc(PS_TIME_UT1);
     532        okay = psMemCheckType(PS_DATA_TIME, time);
     533        if (!okay )
     534            psFree(time);
     535        ok(okay, "psMemCheckTime in memCheckType");
     536        psFree(time);
     537   
     538        psVector *vector;
     539        vector = psVectorAlloc(100, PS_TYPE_F32);
     540        okay = psMemCheckType(PS_DATA_VECTOR, vector);
     541        ok(okay, "psMemCheckVector in memCheckType");
     542        psFree(vector);
     543        psFree(negative);
     544        psFree(neg);
     545        ok(!psMemCheckLeaks(id, NULL, NULL, false), "no memory leaks");
     546    }
    422547}
    423548
     
    455580    psFree( buffer );
    456581
    457     ok ( corruptions == 1,
     582    ok(corruptions == 1,
    458583         "Expected one memory corruption but found %d", corruptions );
    459     skip_start ( corruptions != 1,
    460                  1, "Expected one memory corruption but found %d", corruptions );
    461 
    462     ok ( problemCallbackCalled == 1, "The memProblemCallback was invoked" );
    463 
    464     skip_end();
     584    ok(problemCallbackCalled == 1, "The memProblemCallback was invoked" );
    465585}
    466586#endif
     
    500620}
    501621
    502 psS32 memCheckTypes( void )
    503 {
    504     psArray *negative;
    505     negative = psArrayAlloc(2);
    506     psMetadata *neg;
    507     neg = psMetadataAlloc();
    508 
    509     psArray *array;
    510     array = psArrayAlloc(100);
    511     int okay = psMemCheckType(PS_DATA_ARRAY,array);
    512     if ( ! okay )
    513         psFree(array);
    514     ok ( okay, "psMemCheckArray in memCheckType");
    515     skip_start( ! okay, 28, "psMemCheckArray in memCheckType");
    516 
    517     ok ( psMemCheckType(PS_DATA_ARRAY, neg), "psMemCheckArray in memCheckType");
    518     psFree(array);
    519 
    520     psBitSet *bits;
    521     bits = psBitSetAlloc(100);
    522     okay = psMemCheckType(PS_DATA_BITSET, bits);
    523     if ( ! okay )
    524         psFree(bits);
    525     ok ( okay, "psMemCheckBitSet in memCheckType");
    526     skip_start ( !okay, 27, "psMemCheckBitSet in memCheckType");
    527 
    528     ok ( psMemCheckType(PS_DATA_BITSET, negative),
    529          "psMemCheckBitSet in memCheckType");
    530     psFree(bits);
    531 
    532     psCube *cube;
    533     cube = psCubeAlloc();
    534     okay = psMemCheckType(PS_DATA_CUBE, cube);
    535     if ( ! okay )
    536         psFree(cube);
    537     ok ( okay, "psMemCheckCube in memCheckType");
    538     skip_start ( !okay, 26, "psMemCheckCube in memCheckType");
    539     psFree(cube);
    540 
    541     psFits *fits;
    542     fits = psFitsOpen("test.fits","w");
    543     psImage* img = psImageAlloc(16,16,PS_TYPE_F32);
    544     psFitsWriteImage(fits,NULL,img,1,NULL);
    545     psFree(img);
    546     okay = psMemCheckType(PS_DATA_FITS, fits);
    547     if ( ! okay )
    548         psFree(fits);
    549     ok ( okay, "psMemCheckFits in memCheckType");
    550     skip_start ( !okay, 25,"psMemCheckFits in memCheckType");
    551     psFitsClose(fits);
    552 
    553     psHash *hash;
    554     hash = psHashAlloc(100);
    555     okay = psMemCheckType(PS_DATA_HASH, hash);
    556     if ( ! okay )
    557         psFree(hash);
    558     ok ( okay, "psMemCheckHash in memCheckType");
    559     skip_start ( !okay, 24, "psMemCheckHash in memCheckType");
    560     psFree(hash);
    561 
    562     psHistogram *histogram;
    563     histogram = psHistogramAlloc(1.1, 2.2, 2);
    564     okay = psMemCheckType(PS_DATA_HISTOGRAM, histogram);
    565     if ( ! okay )
    566         psFree(histogram);
    567     ok ( okay, "psMemCheckHistogram in memCheckType");
    568     skip_start ( !okay, 23, "psMemCheckHistogram in memCheckType");
    569     psFree(histogram);
    570 
    571     psImage *image;
    572     image = psImageAlloc(5, 5, PS_TYPE_F32);
    573     okay = psMemCheckType(PS_DATA_IMAGE, image);
    574     if ( ! okay )
    575         psFree(image);
    576     ok ( okay, "psMemCheckImage in memCheckType");
    577     skip_start ( !okay, 22, "psMemCheckImage in memCheckType");
    578     psFree(image);
    579 
    580     psKernel *kernel;
    581     kernel = psKernelAlloc(0, 1, 0, 1);
    582     okay = psMemCheckType(PS_DATA_KERNEL, kernel);
    583     if ( ! okay )
    584         psFree(kernel);
    585     ok ( okay, "psMemCheckKernel in memCheckType");
    586     skip_start ( !okay, 21, "psMemCheckKernel in memCheckType");
    587     psFree(kernel);
    588 
    589     psList *list;
    590     list = psListAlloc(NULL);
    591     okay = psMemCheckType(PS_DATA_LIST, list);
    592     if ( ! okay )
    593         psFree(list);
    594     ok ( okay, "psMemCheckList in memCheckType");
    595     skip_start ( !okay, 20, "psMemCheckList in memCheckType");
    596     psFree(list);
    597 
    598     psLookupTable *lookup;
    599     char *file = "tableF32.dat";
    600     char *format = "\%f \%lf \%d \%ld";
    601     lookup = psLookupTableAlloc(file, format, 10);
    602     okay = psMemCheckType(PS_DATA_LOOKUPTABLE, lookup);
    603     if ( ! okay )
    604         psFree(lookup);
    605     ok ( okay, "psMemCheckLookupTable in memCheckType");
    606     skip_start ( !okay, 19, "psMemCheckLookupTable in memCheckType");
    607     psFree(lookup);
    608 
    609     psMetadata *metadata;
    610     metadata = psMetadataAlloc();
    611     okay = psMemCheckType(PS_DATA_METADATA, metadata);
    612     if ( ! okay )
    613         psFree(metadata);
    614     ok ( okay, "psMemCheckMetadata in memCheckType");
    615     skip_start ( !okay, 18, "psMemCheckMetadata in memCheckType");
    616     psFree(metadata);
    617 
    618     psMetadataItem *metaItem;
    619     metaItem = psMetadataItemAlloc("name", PS_DATA_S32, "COMMENT", 1);
    620     okay = psMemCheckType(PS_DATA_METADATAITEM, metaItem);
    621     if ( ! okay )
    622         psFree(metaItem);
    623     ok ( okay, "psMemCheckMetadataItem in memCheckType");
    624     skip_start ( !okay, 17, "psMemCheckMetadataItem in memCheckType");
    625     psFree(metaItem);
    626 
    627     psMinimization *min;
    628     min = psMinimizationAlloc(3, 0.1);
    629     okay = psMemCheckType(PS_DATA_MINIMIZATION, min);
    630     if ( ! okay )
    631         psFree(min);
    632     ok ( okay, "psMemCheckMinimization in memCheckType");
    633     skip_start ( !okay, 16, "psMemCheckMinimization in memCheckType");
    634     psFree(min);
    635 
    636     psPixels *pixels;
    637     pixels = psPixelsAlloc(100);
    638     okay = psMemCheckType(PS_DATA_PIXELS, pixels);
    639     if ( ! okay )
    640         psFree(pixels);
    641     ok ( okay, "psMemCheckPixels in memCheckType");
    642     skip_start ( !okay, 15, "psMemCheckPixels in memCheckType");
    643     psFree(pixels);
    644 
    645     psPlane *plane;
    646     plane = psPlaneAlloc();
    647     okay = psMemCheckType(PS_DATA_PLANE, plane);
    648     if ( ! okay )
    649         psFree(plane);
    650     ok ( okay, "psMemCheckPlane in memCheckType.");
    651     skip_start ( !okay, 14, "psMemCheckPlane in memCheckType.");
    652     psFree(plane);
    653 
    654     psPlaneDistort *planeDistort;
    655     planeDistort = psPlaneDistortAlloc(1, 1, 1, 1);
    656     okay =  psMemCheckType(PS_DATA_PLANEDISTORT, planeDistort);
    657     if ( ! okay )
    658         psFree(planeDistort);
    659     ok ( okay, "psMemCheckPlaneDistort in memCheckType.");
    660     skip_start ( !okay, 13, "psMemCheckPlaneDistort in memCheckType.");
    661     psFree(planeDistort);
    662 
    663     psPlaneTransform *planeTransform;
    664     planeTransform = psPlaneTransformAlloc(1, 1);
    665     okay = psMemCheckType(PS_DATA_PLANETRANSFORM, planeTransform);
    666     if ( ! okay )
    667         psFree(planeTransform);
    668     ok ( okay, "psMemCheckPlaneTransform in memCheckType");
    669     skip_start ( !okay, 12, "psMemCheckPlaneTransform in memCheckType");
    670     psFree(planeTransform);
    671 
    672     psPolynomial1D *poly1;
    673     poly1 = psPolynomial1DAlloc(PS_POLYNOMIAL_ORD, 2);
    674     okay = psMemCheckType(PS_DATA_POLYNOMIAL1D, poly1);
    675     if ( ! okay )
    676         psFree(poly1);
    677     ok ( okay, "psMemCheckPolynomial1D in memCheckType");
    678     skip_start ( !okay, 11, "psMemCheckPolynomial1D in memCheckType");
    679     psFree(poly1);
    680 
    681     psPolynomial2D *poly2;
    682     poly2 = psPolynomial2DAlloc(PS_POLYNOMIAL_ORD, 2, 1);
    683     okay = psMemCheckType(PS_DATA_POLYNOMIAL2D, poly2);
    684     if ( ! okay )
    685         psFree(poly2);
    686     ok ( okay, "psMemCheckPolynomial2D in memCheckType");
    687     skip_start ( !okay, 10, "psMemCheckPolynomial2D in memCheckType");
    688     psFree(poly2);
    689 
    690     psPolynomial3D *poly3;
    691     poly3 = psPolynomial3DAlloc(PS_POLYNOMIAL_ORD, 2, 1, 1);
    692     okay = psMemCheckType(PS_DATA_POLYNOMIAL3D, poly3);
    693     if ( ! okay )
    694         psFree(poly3);
    695     ok ( okay, "psMemCheckPolynomial3D in memCheckType");
    696     skip_start ( !okay, 9, "psMemCheckPolynomial3D in memCheckType");
    697     psFree(poly3);
    698 
    699     psPolynomial4D *poly4;
    700     poly4 = psPolynomial4DAlloc(PS_POLYNOMIAL_ORD, 2, 1, 2, 1);
    701     okay = psMemCheckType(PS_DATA_POLYNOMIAL4D, poly4);
    702     if ( ! okay )
    703         psFree(poly4);
    704     ok ( okay, "psMemCheckPolynomial4D in memCheckType");
    705     skip_start ( !okay, 8, "psMemCheckPolynomial4D in memCheckType");
    706     psFree(poly4);
    707 
    708     psProjection *proj;
    709     proj = psProjectionAlloc(1, 1, 2.1, 2.1, PS_PROJ_TAN);
    710     okay = psMemCheckType(PS_DATA_PROJECTION, proj);
    711     if ( ! okay )
    712         psFree(proj);
    713     ok ( okay, "psMemCheckProjection in memCheckType.");
    714     skip_start ( !okay, 7, "psMemCheckProjection in memCheckType.");
    715     psFree(proj);
    716 
    717     psScalar *scalar;
    718     psF64 f64 = 1.1;
    719     scalar = psScalarAlloc(f64, PS_TYPE_F64);
    720     okay = psMemCheckType(PS_DATA_SCALAR, scalar);
    721     if ( ! okay )
    722         psFree(scalar);
    723     ok ( okay, "psMemCheckScalar in memCheckType");
    724     skip_start ( !okay, 6, "psMemCheckScalar in memCheckType");
    725     psFree(scalar);
    726 
    727     psSphere *sphere;
    728     sphere = psSphereAlloc();
    729     okay = psMemCheckType(PS_DATA_SPHERE, sphere);
    730     if ( ! okay )
    731         psFree(sphere);
    732     ok ( okay, "psMemCheckSphere in memCheckType");
    733     skip_start ( !okay, 5, "psMemCheckSphere in memCheckType");
    734     psFree(sphere);
    735 
    736     psSphereRot *sphereRot;
    737     sphereRot = psSphereRotAlloc(0, 0, 20);
    738     okay = psMemCheckType(PS_DATA_SPHEREROT, sphereRot);
    739     if ( ! okay )
    740         psFree(sphereRot);
    741     ok( okay, "psMemCheckSphereRot in memCheckType");
    742     skip_start( !okay, 4, "psMemCheckSphereRot in memCheckType");
    743     psFree(sphereRot);
    744 
    745     psSpline1D *spline;
    746     spline = psSpline1DAlloc(2, 1, 0, 2);
    747     okay = psMemCheckType(PS_DATA_SPLINE1D, spline);
    748     if ( ! okay )
    749         psFree(spline);
    750     ok( okay, "psMemCheckSpline1D in memCheckType");
    751     skip_start( !okay, 3, "psMemCheckSpline1D in memCheckType");
    752     psFree(spline);
    753 
    754     psStats *stats;
    755     stats = psStatsAlloc(PS_STAT_MAX);
    756     okay = psMemCheckType(PS_DATA_STATS, stats);
    757     if ( ! okay )
    758         psFree(stats);
    759     ok( okay, "psMemCheckStats in memCheckType");
    760     skip_start( !okay, 2, "psMemCheckStats in memCheckType");
    761     psFree(stats);
    762 
    763     psTime *time;
    764     time = psTimeAlloc(PS_TIME_UT1);
    765     okay = psMemCheckType(PS_DATA_TIME, time);
    766     if ( ! okay )
    767         psFree(time);
    768     ok( okay, "psMemCheckTime in memCheckType");
    769     skip_start( !okay, 1, "psMemCheckTime in memCheckType");
    770     psFree(time);
    771 
    772     psVector *vector;
    773     vector = psVectorAlloc(100, PS_TYPE_F32);
    774     okay = psMemCheckType(PS_DATA_VECTOR, vector);
    775     ok( okay, "psMemCheckVector in memCheckType");
    776     psFree(vector);
    777 
    778     skip_end();
    779     skip_end();
    780     skip_end();
    781     skip_end();
    782     skip_end();
    783     skip_end();
    784     skip_end();
    785     skip_end();
    786     skip_end();
    787     skip_end();
    788     skip_end();
    789     skip_end();
    790     skip_end();
    791     skip_end();
    792     skip_end();
    793     skip_end();
    794     skip_end();
    795     skip_end();
    796     skip_end();
    797     skip_end();
    798     skip_end();
    799     skip_end();
    800     skip_end();
    801     skip_end();
    802     skip_end();
    803     skip_end();
    804     skip_end();
    805     skip_end();
    806 
    807     psFree(negative);
    808     psFree(neg);
    809 
    810     return 0;
    811 }
     622
Note: See TracChangeset for help on using the changeset viewer.