IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 7, 2008, 1:12:13 PM (18 years ago)
Author:
eugene
Message:

various test fixes and cleanups

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/test/math/tap_psMatrix02.c

    r13124 r17567  
    1212 *  @author  Ross Harman, MHPCC
    1313 *
    14  *  @version $Revision: 1.3 $  $Name: not supported by cvs2svn $
    15  *  @date  $Date: 2007-05-02 04:20:06 $
     14 *  @version $Revision: 1.4 $  $Name: not supported by cvs2svn $
     15 *  @date  $Date: 2008-05-07 23:12:13 $
    1616 *
    1717 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2828{
    2929    psLogSetFormat("HLNM");
    30     plan_tests(11);
     30    plan_tests(23);
    3131
    3232    // Input pointer same as output pointer
     
    3434    // a requirement.  However, we should probably fix the case where the input
    3535    // image equals the output image.
    36     if (0) {
     36    {
    3737        psMemId id = psMemGetId();
    3838        psImage *inImage = (psImage*)psImageAlloc(3, 3, PS_TYPE_F64);
    39         ok(psMatrixTranspose(inImage, inImage) == NULL, "psMatrixTranspose(): inImage = outImage results in NULL");
    40         ok(psMemGetRefCounter(inImage) == 1, "psMatrixTranspose(): the output image was freed on an error.");
     39        ok(psMatrixTranspose(inImage, inImage) == NULL, "psMatrixTranspose(): inImage == outImage results in NULL");
    4140        psFree(inImage);
    4241        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     
    5049        psImage *nullImage = NULL;
    5150        psImage *outImage = (psImage*)psImageAlloc(3, 3, PS_TYPE_F64);
    52         psMemIncrRefCounter(outImage);
    5351        ok(psMatrixTranspose(outImage, nullImage) == NULL, "psMatrixTranspose(): inImage = NULL results in NULL return");
    54         ok(psMemGetRefCounter(outImage) == 1, "psMatrixTranspose(): the output image was freed on an error.");
    5552        psFree(outImage);
    5653        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
    5754    }
    5855
    59 
    6056    // Incorrect type for input pointer
    61     // Merge with tap_psMatrix01.c, get rid of this test (redundant)
    6257    {
    6358        psMemId id = psMemGetId();
     59        psImage *inImage = (psImage*)psImageAlloc(3, 3, PS_TYPE_U8);
    6460        psImage *outImage = (psImage*)psImageAlloc(3, 3, PS_TYPE_F64);
    65         psImage *badImage1 = (psImage*)psImageAlloc(3, 3, PS_TYPE_U8);
    66         psMemIncrRefCounter(outImage);
    67         ok(psMatrixTranspose(outImage, badImage1) == NULL, "psMatrixTranspose(): inImage = outImage results in NULL return");
    68         ok(psMemGetRefCounter(outImage) == 1, "the output image was freed on the error.");
     61        ok(psMatrixTranspose(outImage, inImage) == NULL, "psMatrixTranspose(): inImage wrong type (U8) results in NULL return");
    6962        psFree(outImage);
    70         psFree(badImage1);
     63        psFree(inImage);
    7164        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
    7265    }
    7366
     67    // Incorrect type for input pointer
     68    {
     69        psMemId id = psMemGetId();
     70        psImage *inImage = (psImage*)psImageAlloc(3, 3, PS_TYPE_S32);
     71        psImage *outImage = (psImage*)psImageAlloc(3, 3, PS_TYPE_F64);
     72        ok(psMatrixTranspose(outImage, inImage) == NULL, "psMatrixTranspose(): inImage wrong type (S32) results in NULL return");
     73        psFree(outImage);
     74        psFree(inImage);
     75        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     76    }
    7477
    7578    // Incorrect type for output pointer
     
    7780        psMemId id = psMemGetId();
    7881        psImage *inImage = (psImage*)psImageAlloc(3, 3, PS_TYPE_F64);
    79         psImage *badImage1 = (psImage*)psImageAlloc(3, 3, PS_TYPE_U8);
    80         badImage1 = psMatrixTranspose(badImage1, inImage);
    81         ok(badImage1 != NULL, "psMatrixTranspose() results in non-NULL return");
     82        psImage *outImage = (psImage*)psImageAlloc(3, 3, PS_TYPE_U8);
     83        outImage = psMatrixTranspose(outImage, inImage);
     84        ok(outImage != NULL, "psMatrixTranspose() results in non-NULL return");
     85
    8286        // check that the type was changed.
    83         ok(badImage1->type.type == PS_TYPE_F64, "the output type was changed to F64");
     87        ok(outImage->type.type == PS_TYPE_F64, "the output type was changed to F64");
    8488        psFree(inImage);
    85         psFree(badImage1);
     89        psFree(outImage);
    8690        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
    8791    }
    8892
    89 
    90     // Matrix not square for output pointer
    91     // XXX: We should probably do more here.
     93    // output target matrix not square (Nx > Ny) for output pointer
    9294    {
    9395        psMemId id = psMemGetId();
    9496        psImage *inImage = (psImage*)psImageAlloc(3, 3, PS_TYPE_F64);
    95         psImage *badImage2 = (psImage*)psImageAlloc(3, 2, PS_TYPE_F64);
    96         ok(psMatrixTranspose(badImage2, inImage) != NULL, "psMatrixTranspose(): non-square matrix results in non-NULL");
     97        psImage *outImage = (psImage*)psImageAlloc(3, 2, PS_TYPE_F64);
     98        ok(psMatrixTranspose(outImage, inImage) != NULL, "psMatrixTranspose(): non-square matrix results in non-NULL");
     99        ok(outImage->numCols == 3, "psMatrixTranspose(): output matrix dimensions match input");
     100        ok(outImage->numRows == 3, "psMatrixTranspose(): output matrix dimensions match input");
    97101        psFree(inImage);
    98         psFree(badImage2);
     102        psFree(outImage);
     103        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     104    }
     105
     106    // input matrix not square (Nx < Ny)
     107    {
     108        psMemId id = psMemGetId();
     109        psImage *inImage = (psImage*)psImageAlloc(2, 3, PS_TYPE_F64);
     110        psImage *outImage = (psImage*)psImageAlloc(3, 3, PS_TYPE_F64);
     111        ok(psMatrixTranspose(outImage, inImage) != NULL, "psMatrixTranspose(): non-square matrix results in non-NULL");
     112        ok(outImage->numCols == 3, "psMatrixTranspose(): output matrix dimensions match input");
     113        ok(outImage->numRows == 2, "psMatrixTranspose(): output matrix dimensions match input");
     114        psFree(inImage);
     115        psFree(outImage);
     116        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     117    }
     118
     119    // input matrix not square (Nx > Ny)
     120    {
     121        psMemId id = psMemGetId();
     122        psImage *inImage = (psImage*)psImageAlloc(3, 2, PS_TYPE_F64);
     123        psImage *outImage = (psImage*)psImageAlloc(3, 3, PS_TYPE_F64);
     124        ok(psMatrixTranspose(outImage, inImage) != NULL, "psMatrixTranspose(): non-square matrix results in non-NULL");
     125        ok(outImage->numCols == 2, "psMatrixTranspose(): output matrix dimensions match input");
     126        ok(outImage->numRows == 3, "psMatrixTranspose(): output matrix dimensions match input");
     127        psFree(inImage);
     128        psFree(outImage);
    99129        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
    100130    }
Note: See TracChangeset for help on using the changeset viewer.