IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 3, 2005, 4:34:58 PM (22 years ago)
Author:
desonia
Message:

added tests for psRegion functions.

File:
1 edited

Legend:

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

    r2273 r2879  
    66 *  @author Robert DeSonia, MHPCC
    77 *
    8  *  @version $Revision: 1.29 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2004-11-04 01:05:00 $
     8 *  @version $Revision: 1.30 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2005-01-04 02:34:58 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2323static psS32 testImageAlloc(void);
    2424static psS32 testImageCopy(void);
     25static psS32 testRegion(void);
    2526
    2627testDescription tests[] = {
     
    2829                              {testImageAlloc,548,"psImageFree",0,true},
    2930                              {testImageCopy,551,"psImageCopy",0,false},
     31                              {testRegion,790,"psRegionAlloc",0,false},
     32                              {testRegion,791,"psRegionFromString",0,true},
    3033                              {NULL}
    3134                          };
     
    394397}
    395398
     399static psS32 testRegion(void)
     400{
     401    int testNum = 0;
     402
     403
     404    // Testpoint #790
     405
     406    psRegion* region = psRegionAlloc(1,2,3,4);
     407
     408    testNum++;
     409    if (region == NULL) {
     410        psError(PS_ERR_UNKNOWN, false,
     411                "psRegionAlloc returned a NULL pointer.");
     412        return testNum;
     413    }
     414
     415    testNum++;
     416    if (region->x0 != 1 || region->x1 != 2 || region->y0 != 3 || region->y1 != 4) {
     417        psError(PS_ERR_UNKNOWN, false,
     418                "The region attributes are not set properly (%s)",
     419                psRegionToString(region));
     420        return testNum;
     421    }
     422
     423    psFree(region);
     424
     425    // Testpoint #791
     426
     427    region = psRegionFromString("[1:2,3:4]");
     428
     429    testNum++;
     430    if (region == NULL) {
     431        psError(PS_ERR_UNKNOWN, false,
     432                "psRegionFromString returned a NULL pointer.");
     433        return testNum;
     434    }
     435
     436    testNum++;
     437    if (region->x0 != 1 || region->x1 != 2 || region->y0 != 3 || region->y1 != 4) {
     438        psError(PS_ERR_UNKNOWN, false,
     439                "The region attributes are not set properly (%s)",
     440                psRegionToString(region));
     441        return testNum;
     442    }
     443
     444    psFree(region);
     445    region = psRegionFromString("[1:2,3:]");
     446
     447    testNum++;
     448    if (region != NULL) {
     449        psError(PS_ERR_UNKNOWN, false,
     450                "psRegionFromString returned a non-NULL pointer given a malformed string.");
     451        return testNum;
     452    }
     453
     454    return 0;
     455}
Note: See TracChangeset for help on using the changeset viewer.