IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 27, 2004, 3:24:46 PM (22 years ago)
Author:
evanalst
Message:

Add cases for tst_psImageManip.

File:
1 edited

Legend:

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

    r1909 r1914  
    66 *  @author Robert DeSonia, MHPCC
    77 *
    8  *  @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2004-09-28 00:30:32 $
     8 *  @version $Revision: 1.21 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2004-09-28 01:24:46 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    1212 */
     13
    1314
    1415#include <math.h>
     
    601602    psImage* img = NULL;
    602603    psImage* img2 = NULL;
     604    psImage* img3 = NULL;
     605    psImage* img4 = NULL;
    603606    unsigned int c = 128;
    604607    unsigned int r = 256;
     
    700703        }
    701704    }
     705    img3 = psImageAlloc(c,r,PS_TYPE_S64);
     706    for (unsigned row=0;row<r;row++) {
     707        psS64* img3Row = img3->data.S64[row];
     708        for (unsigned col=0;col<c;col++) {
     709            img3Row[col] = 6.0f;
     710        }
     711    }
     712    img4 = psImageAlloc(c,r,PS_TYPE_S64);
     713    for (unsigned row=0;row<r;row++) {
     714        psS64* img4Row = img4->data.S64[row];
     715        for (unsigned col=0;col<c;col++) {
     716            img4Row[col] = 2.0f;
     717        }
     718    }
    702719
    703720    psLogMsg(__func__,PS_LOG_INFO,"Following should error as overlay isn't "
     
    756773
    757774    /*
     775    Verify the return integer is equal to non-zero and program execution
     776    doesn't stop, if the specified operator is not =,+,-,*,/
     777    */
     778
     779    psLogMsg(__func__,PS_LOG_INFO,"Following should error as operator is invalid");
     780    retVal = psImageOverlaySection(img,img2,0,0,"$");
     781    if (retVal == 0) {
     782        psError(__func__,"psImageOverlaySection returned zero even though "
     783                "overlay operator is invalid");
     784        return 8;
     785    }
     786
     787    /*
     788    Verify the return integer is equal to non-zero and program execution
     789    doesn't stop, if the specified operator is NULL
     790    */
     791
     792    psLogMsg(__func__,PS_LOG_INFO,"Following should error as operator is invalid");
     793    retVal = psImageOverlaySection(img,img2,0,0,NULL);
     794    if(retVal == 0) {
     795        psError(__func__,"psImageOverlaySection returned zero even though "
     796                "overlay operator is NULL");
     797        return 9;
     798    }
     799
     800    /*
     801    Verify the return integer is equal to non-zero and program execution
     802    doesn't stop, if overlay image is a different type than the input image
     803    */
     804    psLogMsg(__func__,PS_LOG_INFO,"Following should error as overlay is "
     805             "a different type");
     806    retVal = psImageOverlaySection(img,img3,0,0,"+");
     807    if(retVal == 0) {
     808        psError(__func__,"psImageOverlaySection returned zero eventhough "
     809                " overlay image type is different than input image.");
     810        return 10;
     811    }
     812
     813    /*
     814    Verify the return integer is equal to non-zero and program execution
     815    doesn't stop, if invalid input and overlay images
     816    */
     817    psLogMsg(__func__,PS_LOG_INFO,"Following should error as overlay and "
     818             "image are not valid for the psImageOverlaySection function.");
     819    retVal = psImageOverlaySection(img3,img4,0,0,"+");
     820    if(retVal == 0) {
     821        psError(__func__,"psImageOverlaySection returned zero eventhough "
     822                "overlay and image type are invalid type.");
     823        return 11;
     824    }
     825
     826    /*
    758827    Verify program execution doen't stop, if the overly image contains
    759828    zero values with division operation is specified.
     
    769838        psError(__func__,"psImageOverlaySection returned non-zero when "
    770839                "checking divide-by-zero.");
    771         return 8;
     840        return 12;
    772841    }
    773842
    774843    psFree(img);
    775844    psFree(img2);
     845    psFree(img3);
     846    psFree(img4);
    776847
    777848    return 0;
Note: See TracChangeset for help on using the changeset viewer.