IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 26, 2005, 12:35:54 PM (21 years ago)
Author:
drobbin
Message:

Implemented, updated, fixed, debugged the CountPixelMask fxns and tests

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

Legend:

Unmodified
Added
Removed
  • trunk/psLib/test/mathtypes/tst_psVector.c

    r5118 r5137  
    1414 *  @author  Ross Harman, MHPCC
    1515 *
    16  *  @version $Revision: 1.6 $  $Name: not supported by cvs2svn $
    17  *  @date  $Date: 2005-09-24 01:33:12 $
     16 *  @version $Revision: 1.7 $  $Name: not supported by cvs2svn $
     17 *  @date  $Date: 2005-09-26 22:35:54 $
    1818 *
    1919 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    3030static psS32 testVectorCreate(void);
    3131static psS32 testVectorGetSet(void);
     32static psS32 testVectorCountPixelMask(void);
    3233
    3334testDescription tests[] = {
     
    3839                              {testVectorCreate,-5,"psVectorCreate",0,false},
    3940                              {testVectorGetSet,-6,"psVectorGet/Set",0,false},
     41                              {testVectorCountPixelMask,-7,"psVectorCountPixelMask",0,false},
    4042                              {NULL}
    4143                          };
     
    414416}
    415417
    416 
    417 
     418psS32 testVectorCountPixelMask(void)
     419{
     420    long numPix = 0;
     421    long numPix2 = 0;
     422    psVector *vec = NULL;
     423    numPix = psVectorCountPixelMask(vec, 1);
     424
     425    if (numPix != -1) {
     426        psError(PS_ERR_BAD_PARAMETER_VALUE, false,
     427                "psVectorCountPixelMask failed to return -1 for NULL Vector input.\n");
     428        return 1;
     429    }
     430
     431    numPix = 0;
     432    vec = psVectorAlloc(5, PS_TYPE_S32);
     433    psVector *vec2 = NULL;
     434    vec2 = psVectorAlloc(5, PS_TYPE_U8);
     435    vec->data.S32[0] = 0;
     436    vec->data.S32[1] = 1;
     437    vec->data.S32[2] = 0;
     438    vec->data.S32[3] = 1;
     439    vec->data.S32[4] = 0;
     440    vec2->data.U8[0] = 0;
     441    vec2->data.U8[1] = 1;
     442    vec2->data.U8[2] = 0;
     443    vec2->data.U8[3] = 1;
     444    vec2->data.U8[4] = 0;
     445    numPix = psVectorCountPixelMask(vec, 1);
     446    numPix2 = psVectorCountPixelMask(vec2, 1);
     447
     448    if (numPix != -1) {
     449        psError(PS_ERR_BAD_PARAMETER_VALUE, false,
     450                "psVectorCountPixelMask failed to return -1 for wrong type of Vector input.\n");
     451        return 2;
     452    }
     453    if (numPix2 == -1) {
     454        psError(PS_ERR_BAD_PARAMETER_VALUE, false,
     455                "psVectorCountPixelMask returned -1 for correct Vector input\n");
     456        return 3;
     457    }
     458    if (numPix2 != 2) {
     459        psError(PS_ERR_BAD_PARAMETER_VALUE, false,
     460                "psVectorCountPixelMask returned incorrect pixel count %d\n", numPix2);
     461        return 4;
     462    }
     463
     464    psFree(vec);
     465    psFree(vec2);
     466    return 0;
     467}
     468
  • trunk/psLib/test/mathtypes/verified/tst_psVector.stderr

    r5114 r5137  
    6969---> TESTPOINT PASSED (psVector{psVectorGet/Set} | tst_psVector.c)
    7070
     71/***************************** TESTPOINT ******************************************\
     72*             TestFile: tst_psVector.c                                             *
     73*            TestPoint: psVector{psVectorCountPixelMask}                           *
     74*             TestType: Positive                                                   *
     75\**********************************************************************************/
     76
     77<DATE><TIME>|<HOST>|E|psVectorCountPixelMask (FILE:LINENO)
     78    The input psVector can not be NULL.
     79<DATE><TIME>|<HOST>|E|psVectorCountPixelMask (FILE:LINENO)
     80    Input psVector is an unsupported type (0x104).
     81
     82---> TESTPOINT PASSED (psVector{psVectorCountPixelMask} | tst_psVector.c)
     83
Note: See TracChangeset for help on using the changeset viewer.