IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 12331


Ignore:
Timestamp:
Mar 8, 2007, 12:13:32 PM (19 years ago)
Author:
Paul Price
Message:

Fixing tests following API changes.

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

Legend:

Unmodified
Added
Removed
  • trunk/psLib/test/types/tap_psLookupTable_all.c

    r11666 r12331  
    8686    psArray *vectors = NULL;
    8787    psLookupTable*  table1  = NULL;
    88     psLookupTable*  tableOut  = NULL;
    8988    long           numRows = 0;
    9089
     
    205204    // Attempt to import table with negative indexCol
    206205    vectors = psVectorsReadFromFile(table1->filename, table1->format);
    207     tableOut = psLookupTableImport(table1, vectors, -1 );
    208     {
    209         ok( tableOut == NULL,
    210             "psLookupTableImport:             return NULL for negative indexCol input.");
     206    {
     207        ok( !psLookupTableImport(table1, vectors, -1 ),
     208            "psLookupTableImport:             return false for negative indexCol input.");
    211209    }
    212210    //Attempt to import table with unsorted array column
     
    214212    table1 = psLookupTableAlloc("table.dat",
    215213                                "\%f \%d \%d \%ld \%d \%d \%d \%ld \%*d \%lf", 0);
    216     tableOut = psLookupTableImport(table1, vectors, 7 );
    217     {
    218         ok( tableOut != NULL,
    219             "psLookupTableImport:             return correct table for array with unsorted column");
     214    {
     215        ok( psLookupTableImport(table1, vectors, 7 ),
     216            "psLookupTableImport:             return true for array with unsorted column");
    220217    }
    221218
  • trunk/psLib/test/types/tap_psPixels_all.c

    r10822 r12331  
    33 *
    44 * Description:  Tests for psPixelsAlloc, psPixelsRealloc, psMemCheckPixels,
    5  *               psPixelsCopy, psPixels(To/From)Mask, p_psPixelsAppend, psPixelsLength,
     5 *               psPixelsCopy, psPixels(To/From)Mask, p_psPixelsAdd, psPixelsLength,
    66 *               psPixels(Set/Get), psPixelsConcatenate
    77 *
     
    2323int main(void)
    2424{
    25     plan_tests(38);
     25    plan_tests(36);
    2626
    2727    note("Tests for psPixels Functions");
     
    4040    psPixels* p0 = psPixelsAlloc(0);
    4141    {
    42         ok(p0 != NULL && p0->n == 0 && p0->data == NULL && p0->nalloc == 0,
     42        ok(p0 != NULL && p0->n == 0 && p0->nalloc == 0,
    4343           "psPixelsAlloc:         return newly allocated psPixels of 0 length.");
    4444    }
     
    4646    psPixels* p1 = psPixelsAlloc(1);
    4747    {
    48         ok(p1 != NULL && p1->n == 0 && p1->data != NULL && p1->nalloc == 1,
     48        ok(p1 != NULL && p1->n == 1 && p1->data != NULL && p1->nalloc == 1,
    4949           "psPixelsAlloc:         return newly allocated psPixels of 1 length.");
    5050    }
     
    6060            "psMemCheckPixels:      return false for non-psPixels input.");
    6161    }
    62     //Return a psPixels for attempt to Reallocate a NULL psPixels.
    63     {
    64         psPixels *noPix = NULL;
    65         noPix = psPixelsRealloc(noPix, 1);
    66         ok(noPix != NULL && noPix->n == 0 && noPix->data != NULL && noPix->nalloc == 1,
    67            "psPixelsRealloc:       return re-allocated psPixels of 1 length.");
    68         psFree(noPix);
    69     }
    7062    //Return a 0-length allocated psPixels on Realloc with 0
    7163    {
    72         psPixels *noPix = NULL;
    73         noPix = psPixelsRealloc(noPix, 1);
     64        psPixels *noPix = psPixelsAlloc(1);
    7465        noPix = psPixelsRealloc(noPix, 0);
    75         ok( noPix->n == 0 && noPix->data == NULL && noPix->nalloc == 0,
     66        ok( noPix->n == 0 && noPix->nalloc == 0,
    7667            "psPixelsRealloc:       return re-allocated psPixels of 0 length.");
    7768        psFree(noPix);
    7869    }
    7970    //Return a properly down-sized psPixels.
    80     p0 = p_psPixelsAppend(p0, 1, 1.1, 1.2);
    81     p0 = p_psPixelsAppend(p0, 1, 2.1, 2.2);
    82     p0 = p_psPixelsAppend(p0, 1, 3.1, 3.2);
    83     p0 = p_psPixelsAppend(p0, 0, 4.1, 4.2);
     71    p0 = psPixelsAdd(p0, 1, 1.1, 1.2);
     72    p0 = psPixelsAdd(p0, 1, 2.1, 2.2);
     73    p0 = psPixelsAdd(p0, 1, 3.1, 3.2);
     74    p0 = psPixelsAdd(p0, 0, 4.1, 4.2);
    8475    {
    8576        skip_start(  psPixelsLength(p0) != 4, 1,
     
    10596            "psPixelsCopy:          return NULL for NULL psPixels input.");
    10697    }
    107     //Try to get the length of a non-psPixels object
    108     {
    109         psVector *vector = psVectorAlloc(5, PS_TYPE_F32);
    110         ok( psPixelsLength((psPixels*)vector) == -1,
    111             "psPixelsLength:       return -1 for non-psPixels input.");
    112         psFree(vector);
    113     }
    11498
    11599    //Check for Memory leaks
     
    212196            ("psPixels.out");
    213197    }
    214     //Return true for NULL pixels and name inputs
    215     {
    216         ok ( p_psPixelsPrint(stdout, NULL, NULL),
    217              "p_psPixelsPrint:      return true for NULL pixels and name inputs.");
     198    //Return false for NULL pixels and name inputs
     199    {
     200        ok ( !p_psPixelsPrint(stdout, NULL, NULL),
     201             "p_psPixelsPrint:      return false for NULL pixels and name inputs.");
    218202    }
    219203    //Return true for empty pixel data.
     
    270254    }
    271255    //Return valid image for valid inputs
    272     p0 = p_psPixelsAppend(p0, 1, 2.1, 2.2);
    273     p0 = p_psPixelsAppend(p0, 1, 3.1, 3.2);
    274     p0 = p_psPixelsAppend(p0, 1, 1.0, 1.0);
     256    p0 = psPixelsAdd(p0, 1, 2.1, 2.2);
     257    p0 = psPixelsAdd(p0, 1, 3.1, 3.2);
     258    p0 = psPixelsAdd(p0, 1, 1.0, 1.0);
    275259    {
    276260        outImage = psPixelsToMask(outImage, p0, region, maskVal);
     
    288272        }
    289273    }
     274
    290275    psPixels *outPixels = NULL;
    291276    {
    292277        outPixels = psPixelsFromMask(outPixels, outImage, maskVal);
    293278        ok ( outPixels != NULL,
    294              "psPixelsFromMask:     return valid image for valid input.");
    295     }
     279             "psPixelsFromMask:     return valid pixels for valid input.");
     280        psFree(outPixels);
     281    }
     282
    296283    //Return NULL for NULL image input
    297284    {
    298         outPixels = psPixelsFromMask(outPixels, NULL, maskVal);
     285        psPixels *outPixels = psPixelsFromMask(outPixels, NULL, maskVal);
    299286        ok ( outPixels == NULL,
    300287             "psPixelsFromMask:     return NULL for NULL image input.");
     
    303290    *(psElemType*)&(outImage->type.type) = PS_TYPE_U32;
    304291    {
    305         outPixels = psPixelsFromMask(outPixels, outImage, maskVal);
     292        psPixels *outPixels = psPixelsFromMask(outPixels, outImage, maskVal);
    306293        ok ( outPixels == NULL,
    307294             "psPixelsFromMask:     return NULL for image with wrong maskType.");
     
    311298    //Return NULL for NULL pixels input
    312299    {
    313         outPixels = psPixelsConcatenate(outPixels, NULL);
     300        psPixels *outPixels = psPixelsConcatenate(outPixels, NULL);
    314301        ok ( outPixels == NULL,
    315302             "psPixelsConcatenate:  return NULL for NULL pixels input.");
    316303    }
     304
     305
    317306    //Return copy of input pixels for NULL out pixels
    318307    {
     308        outPixels = psPixelsFromMask(outPixels, outImage, maskVal);
    319309        outPixels = psPixelsConcatenate(outPixels, p0);
    320310        ok ( outPixels->n == 4 && fabs(outPixels->data[0].x - 1.1) < FLT_EPSILON &&
Note: See TracChangeset for help on using the changeset viewer.