IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 4886


Ignore:
Timestamp:
Aug 25, 2005, 5:35:03 PM (21 years ago)
Author:
drobbin
Message:

Added tests for ImageInit, RegionForSquare, RegionForImage. edited Init

Location:
trunk/psLib
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/mathtypes/psImage.c

    r4815 r4886  
    99 *  @author Ross Harman, MHPCC
    1010 *
    11  *  @version $Revision: 1.75 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2005-08-18 21:44:40 $
     11 *  @version $Revision: 1.76 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2005-08-26 03:35:02 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    209209    psF32 vF32;
    210210    psF64 vF64;
     211    int temp;
    211212
    212213    if (image == NULL)
     
    217218    switch (image->type.type) {
    218219    case PS_TYPE_U8:
    219         vU8 = va_arg (argp, psU32);
    220 
     220        temp = va_arg (argp, psU32);
     221        if ( temp >= 0 || temp <= 255 )
     222            vU8 = temp;
     223        else
     224            psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Error:  U8 Value out of Range.\n");
    221225        for (int iy = 0; iy < image->numRows; iy++) {
    222226            for (int ix = 0; ix < image->numCols; ix++) {
     
    224228            }
    225229        }
    226         break;
     230        return (true);
    227231
    228232    case PS_TYPE_F32:
  • trunk/psLib/src/mathtypes/psImage.h

    r4815 r4886  
    1111 *  @author Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.62 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2005-08-18 21:44:40 $
     13 *  @version $Revision: 1.63 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2005-08-26 03:35:02 $
    1515 *
    1616 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
  • trunk/psLib/test/mathtypes/tst_psImage.c

    r4547 r4886  
    66 *  @author Robert DeSonia, MHPCC
    77 *
    8  *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2005-07-13 02:47:00 $
     8 *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2005-08-26 03:35:03 $
    1010 *
    1111 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2323static psS32 testImageAlloc(void);
    2424static psS32 testRegion(void);
     25static psS32 testRegion2(void);
     26static psS32 testRegion3(void);
     27static psS32 testImageInit(void);
    2528
    2629testDescription tests[] = {
     
    2932                              {testRegion,790,"psRegionSet",0,false},
    3033                              {testRegion,791,"psRegionFromString",0,true},
     34                              {testRegion2,792,"psRegionForImage",0,false},
     35                              {testRegion3,793,"psRegionForSquare",0,false},
     36                              {testImageInit,794,"psImageInit",0,false},
    3137                              {NULL}
    3238                          };
     
    275281    return 0;
    276282}
     283
     284//psRegionForImage//
     285static psS32 testRegion2(void)
     286{
     287    psImage *in = NULL;
     288    psRegion *inReg;
     289    psRegion out;
     290    in = psImageAlloc(1, 1, PS_TYPE_S32);
     291    *inReg = psRegionSet(1, 2, 1, 2);
     292    out = psRegionForImage(in, inReg);
     293    psRegion *inReg2;
     294    psRegion out2;
     295    *inReg2 = psRegionSet(-1, 0, -2, -1);
     296    out2 = psRegionForImage(in, inReg2);
     297    if( out.x0 != 1 || out.x1 != 1 || out.y0 != 1 || out.y1 != 1 ) {
     298        psError(PS_ERR_UNKNOWN, true, "Error:  Region For Image returned incorrect values.\n");
     299    }
     300    if( out2.x0 != 0 || out2.x1 != 1 || out2.y0 != 0 || out2.y1 != 0 ) {
     301        psError(PS_ERR_UNKNOWN, true, "Error:  Region For Image returned incorrect values.\n");
     302    }
     303    psFree(in);
     304    return 0;
     305}
     306
     307//psRegionForSquare//
     308static psS32 testRegion3(void)
     309{
     310    float X = 1;
     311    float Y = 1;
     312    float RAD = 1;
     313    psRegion out;
     314    out = psRegionForSquare(X, Y, RAD);
     315    if (out.x0 != 0 || out.x1 != 3 || out.y0 != 0 || out.y1!= 3)
     316        psError(PS_ERR_UNKNOWN, true, "Error:  Region For Square returned incorrect values.\n");
     317    return 0;
     318}
     319
     320//Initialize an image with a given value.//
     321static psS32 testImageInit(void)
     322{
     323    psImage *in1 = NULL;
     324    psImage *in2 = NULL;
     325    psImage *in3 = NULL;
     326    psImage *in4 = NULL;
     327    int nRow = 1;
     328    int nCol = 1;
     329    in1 = psImageAlloc(nRow, nCol, PS_TYPE_U8);
     330    if ( !psImageInit(in1, 1 ) ) {
     331        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "ImageInit failed.  U8 Case - 1x1\n");
     332    }
     333    nRow = 5;
     334    in2 = psImageAlloc(nRow, nCol, PS_TYPE_F32);
     335    if ( !psImageInit(in2, 3) ) {
     336        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "ImageInit failed.  F32 Case - 5x1\n");
     337    }
     338    nCol = 5;
     339    in3 = psImageAlloc(nRow, nCol, PS_TYPE_F64);
     340    if ( !psImageInit(in3, 3.141) ) {
     341        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "ImageInit failed.  F64 Case - 5x5\n");
     342    }
     343    in4 = psImageAlloc(nRow, nCol, PS_TYPE_S32);
     344    if ( !psImageInit(in4, 3) ) {
     345        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "ImageInit failed.  S32 Case - 5x5\n");
     346    }
     347    psFree(in1);
     348    psFree(in2);
     349    psFree(in3);
     350    psFree(in4);
     351    return 0;
     352}
     353
  • trunk/psLib/test/mathtypes/verified/tst_psImage.stderr

    r4547 r4886  
    9797---> TESTPOINT PASSED (psImage{psRegionSet} | tst_psImage.c)
    9898
     99/***************************** TESTPOINT ******************************************\
     100*             TestFile: tst_psImage.c                                              *
     101*            TestPoint: psImage{psRegionForImage}                                  *
     102*             TestType: Positive                                                   *
     103\**********************************************************************************/
     104
     105
     106---> TESTPOINT PASSED (psImage{psRegionForImage} | tst_psImage.c)
     107
     108/***************************** TESTPOINT ******************************************\
     109*             TestFile: tst_psImage.c                                              *
     110*            TestPoint: psImage{psRegionForSquare}                                 *
     111*             TestType: Positive                                                   *
     112\**********************************************************************************/
     113
     114
     115---> TESTPOINT PASSED (psImage{psRegionForSquare} | tst_psImage.c)
     116
     117/***************************** TESTPOINT ******************************************\
     118*             TestFile: tst_psImage.c                                              *
     119*            TestPoint: psImage{psImageInit}                                       *
     120*             TestType: Positive                                                   *
     121\**********************************************************************************/
     122
     123<DATE><TIME>|<HOST>|E|psImageInit (FILE:LINENO)
     124    datatype 260 not defined in psImageInit
     125<DATE><TIME>|<HOST>|E|testImageInit (FILE:LINENO)
     126    ImageInit failed.  S32 Case - 5x5
     127
     128---> TESTPOINT PASSED (psImage{psImageInit} | tst_psImage.c)
     129
Note: See TracChangeset for help on using the changeset viewer.