IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 1930


Ignore:
Timestamp:
Sep 29, 2004, 11:23:30 AM (22 years ago)
Author:
evanalst
Message:

Add test cases for all type for psImageRoll.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/test/image/tst_psImageManip.c

    r1929 r1930  
    66 *  @author Robert DeSonia, MHPCC
    77 *
    8  *  @version $Revision: 1.24 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2004-09-29 20:17:58 $
     8 *  @version $Revision: 1.25 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2004-09-29 21:23:30 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    10881088    int rows = 64;
    10891089    int cols = 64;
    1090 
     1090    int rows1 = 8;
     1091    int cols1 = 8;
    10911092
    10921093    /*
     
    12291230    psFree(in);
    12301231    psFree(out);
     1232
     1233    #define testRollType(DATATYPE) \
     1234    in = psImageAlloc(rows1,cols1,PS_TYPE_##DATATYPE); \
     1235    \
     1236    for (int row=0;row<rows1;row++) { \
     1237        ps##DATATYPE* inRow = in->data.DATATYPE[row]; \
     1238        for (int col=0;col<cols1;col++) { \
     1239            inRow[col] = (ps##DATATYPE)row+(ps##DATATYPE)col; \
     1240        } \
     1241    } \
     1242    \
     1243    out = psImageRoll(NULL,in,rows1/4,cols1/4); \
     1244    for (int row=0;row<rows1;row++) { \
     1245        ps##DATATYPE* inRow = in->data.DATATYPE[(row+rows1/4)%rows1]; \
     1246        ps##DATATYPE* outRow = out->data.DATATYPE[row]; \
     1247        for (int col=0;col<cols1;col++) { \
     1248            if (inRow[(col+cols1/4)%cols1] != outRow[col]) { \
     1249                psError(__func__,"psImageRoll didn't produce expected result " \
     1250                        "at %d,%d (%f vs %f) for dx=0, dy=0.", \
     1251                        col,row,(float)inRow[col],(float)outRow[col]); \
     1252                return 3; \
     1253            } \
     1254        } \
     1255    } \
     1256    psFree(in); \
     1257    psFree(out);
     1258
     1259    testRollType(U8);
     1260    testRollType(U16);
     1261    testRollType(S8);
     1262    testRollType(S16);
     1263    testRollType(F64);
     1264    testRollType(C32);
     1265    testRollType(C64);
    12311266
    12321267    return 0;
Note: See TracChangeset for help on using the changeset viewer.