IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 1212


Ignore:
Timestamp:
Jul 12, 2004, 3:37:59 PM (22 years ago)
Author:
desonia
Message:

removed the dependency creation stuff, as George hated it ALOT!

Location:
trunk/psLib/test
Files:
1 added
20 deleted
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/test/collections/Makefile

    r1171 r1212  
    33##  Makefile:   test/collections
    44##
    5 ##  $Revision: 1.17 $  $Name: not supported by cvs2svn $
    6 ##  $Date: 2004-07-01 21:45:54 $
     5##  $Revision: 1.18 $  $Name: not supported by cvs2svn $
     6##  $Date: 2004-07-13 01:37:58 $
    77##
    88##  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    1616include ../../src/Makefile.Globals
    1717
    18 PSLIB_INCL_DIR = ../../include
    19 
    20 PSLIB_LIB_DIR = ../../lib
     18CFLAGS := -I../../include $(CFLAGS)
     19LDFLAGS := -L../../lib -lpslib -lpstest $(LDFLAGS)
    2120
    2221TARGET = tst_psVector_01 \
     
    3837         tst_psList
    3938
    40 DEPENDENCIES = $(addprefix builddir/,$(addsuffix .d,$(TARGET)))
    41 OBJS = $(addprefix builddir/,$(addsuffix .o,$(TARGET)))
     39OBJS = $(addsuffix .o,$(TARGET))
    4240
    43 all: builddir $(TARGET)
    44 
    45 builddir:
    46         mkdir builddir
    47 
    48 include $(DEPENDENCIES)
     41all: $(TARGET)
    4942
    5043clean:
    5144        @echo "    Deleting executable and binary files for 'test/collections'"
    52         $(RM) $(OBJS) *.lint builddir/*.i
     45        $(RM) $(OBJS)
    5346
    5447distclean: clean
    5548        $(RM) $(TARGET)
    56 
    57 cleandependencies:
    58         $(RM) $(DEPENDENCIES)
    59 
    60 builddir/%.o : builddir/%.i
    61         $(CC) $(CFLAGS) -I$(PSLIB_INCL_DIR) -c -o $@ $<
    62 
    63 builddir/%.o : %.c
    64         $(CC) $(CFLAGS) -I$(PSLIB_INCL_DIR) -c -o $@ $<
    65 
    66 %   : builddir/%.o
    67         $(CC) -o $@ $< -L$(PSLIB_LIB_DIR) -lpslib -lpstest $(LDFLAGS)
    68 
    69 %.lint: %.c
    70         splint +posixlib -exportlocal -realcompare $(INCLUDE_GLOBAL) $? > $@; cat $@
    71 
    72 builddir/%.i: %.c
    73         $(CC) -E $(CFLAGS) $(CPPFLAGS) -I$(PSLIB_INCL_DIR) -o $@ $<
    74 
    75 builddir/%.d: %.c
    76         $(CC) -MM $(CFLAGS) -I$(PSLIB_INCL_DIR) $< | sed 's|\(.*\.o\)|builddir/\1|' > $@
    7749
    7850install: $(testbindir) $(testbindir)/verified $(TARGET)
  • trunk/psLib/test/collections/builddir/tst_psImage.d

    r1126 r1212  
    77  ../../include/psBitSet.h ../../include/psSort.h ../../include/psStats.h \
    88  ../../include/psMatrix.h ../../include/psMatrixVectorArithmetic.h \
    9   ../../include/psFFT.h ../../include/psImageIO.h
     9  ../../include/psFFT.h ../../include/psImageIO.h \
     10  ../../include/psImageManip.h ../../include/psFunctions.h \
     11  ../../include/psMinimize.h
  • trunk/psLib/test/dataManip/Makefile

    r1187 r1212  
    33##  Makefile:   test/sysUtils
    44##
    5 ##  $Revision: 1.32 $  $Name: not supported by cvs2svn $
    6 ##  $Date: 2004-07-07 02:39:21 $
     5##  $Revision: 1.33 $  $Name: not supported by cvs2svn $
     6##  $Date: 2004-07-13 01:37:59 $
    77##
    88##  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    1010###############################################################################
    1111
     12ifndef prefix
     13    export prefix=$(shell cd ../..;pwd)
     14endif
     15
    1216include ../../src/Makefile.Globals
    1317
    14 PSLIB_INCL_DIR = ../../include
     18CFLAGS := -I../../include $(CFLAGS)
     19LDFLAGS := -L../../lib -lpslib -lpstest $(LDFLAGS)
    1520
    16 PSLIB_LIB_DIR = ../../lib
     21TARGET = \
     22tst_psFunc00 \
     23tst_psFunc01 \
     24tst_psHist00 \
     25tst_psHist01 \
     26tst_psHist02 \
     27tst_psImageFFT \
     28tst_psImageIO \
     29tst_psImageManip \
     30tst_psImageStats00 \
     31tst_psImageStats01 \
     32tst_psImageStats02 \
     33tst_psImageStats03 \
     34tst_psMatrix01 \
     35tst_psMatrix02 \
     36tst_psMatrix03 \
     37tst_psMatrix04 \
     38tst_psMatrix05 \
     39tst_psMatrix06 \
     40tst_psMatrix07 \
     41tst_psMatrixVectorArithmetic01 \
     42tst_psMatrixVectorArithmetic02 \
     43tst_psMatrixVectorArithmetic03 \
     44tst_psMinimize00 \
     45tst_psMinimize01 \
     46tst_psMinimize02 \
     47tst_psMinimize03 \
     48tst_psMinimize04 \
     49tst_psStats00 \
     50tst_psStats01 \
     51tst_psStats02 \
     52tst_psStats03 \
     53tst_psStats05 \
     54tst_psStats06 \
     55tst_psStats07 \
     56tst_psStats08 \
     57tst_psStats09 \
     58tst_psVectorFFT
    1759
    18 TARGET = tst_psMatrix01 \
    19  tst_psMatrix02 \
    20  tst_psMatrix03 \
    21  tst_psMatrix04 \
    22  tst_psMatrix05 \
    23  tst_psMatrix06 \
    24  tst_psMatrix07 \
    25  tst_psMatrixVectorArithmetic01 \
    26  tst_psMatrixVectorArithmetic02 \
    27  tst_psMatrixVectorArithmetic03 \
    28  tst_psStats00 \
    29  tst_psStats01 \
    30  tst_psStats02 \
    31  tst_psStats03 \
    32  tst_psStats05 \
    33  tst_psStats06 \
    34  tst_psStats07 \
    35  tst_psStats08 \
    36  tst_psStats09 \
    37  tst_psHist00 \
    38  tst_psHist01 \
    39  tst_psHist02 \
    40  tst_psFunc00 \
    41  tst_psFunc01 \
    42  tst_psMinimize00 \
    43  tst_psMinimize01 \
    44  tst_psMinimize02 \
    45  tst_psMinimize03 \
    46  tst_psImageStats00 \
    47  tst_psImageStats01 \
    48  tst_psImageStats02
     60OBJS = $(addsuffix .o,$(TARGET))
    4961
    5062all: $(TARGET)
    5163
    52 tst_psMatrix01:         tst_psMatrix01.o
    53 tst_psMatrix02:         tst_psMatrix02.o
    54 tst_psMatrix03:         tst_psMatrix03.o
    55 tst_psMatrix04:         tst_psMatrix04.o
    56 tst_psMatrix05:         tst_psMatrix05.o
    57 tst_psMatrix06:         tst_psMatrix06.o
    58 tst_psMatrix07:         tst_psMatrix07.o
    59 tst_psMatrixVectorArithmetic01: tst_psMatrixVectorArithmetic01.o
    60 tst_psMatrixVectorArithmetic02: tst_psMatrixVectorArithmetic02.o
    61 tst_psMatrixVectorArithmetic03: tst_psMatrixVectorArithmetic03.o
    62 tst_psStats00:          tst_psStats00.o
    63 tst_psStats01:          tst_psStats01.o
    64 tst_psStats02:          tst_psStats02.o
    65 tst_psStats03:          tst_psStats03.o
    66 tst_psStats04:          tst_psStats04.o
    67 tst_psStats05:          tst_psStats05.o
    68 tst_psStats06:          tst_psStats06.o
    69 tst_psStats07:          tst_psStats07.o
    70 tst_psStats08:          tst_psStats08.o
    71 tst_psStats09:          tst_psStats09.o
    72 tst_psHist00:           tst_psHist00.o
    73 tst_psHist01:           tst_psHist01.o
    74 tst_psHist02:           tst_psHist02.o
    75 tst_psFunc00:           tst_psFunc00.o
    76 tst_psFunc01:           tst_psFunc01.o
    77 tst_psFunc02:           tst_psFunc02.o
    78 tst_psFunc03:           tst_psFunc03.o
    79 tst_psMinimize00:       tst_psMinimize00.o
    80 tst_psMinimize01:       tst_psMinimize01.o
    81 tst_psMinimize02:       tst_psMinimize02.o
    82 tst_psMinimize03:       tst_psMinimize03.o
    83 tst_psMinimize04:       tst_psMinimize04.o
    84 tst_psMinimize05:       tst_psMinimize05.o
    85 tst_psImageStats00:     tst_psImageStats00.o
    86 tst_psImageStats01:     tst_psImageStats01.o
    87 tst_psImageStats02:     tst_psImageStats02.o
    88 tst_psImageStats03:     tst_psImageStats03.o
     64# include $(DEPENDENCIES)
    8965
    9066clean:
    91         @echo "    Deleting executable and binary files for 'test/sysUtils'"
    92         $(RM) $(TARGET) *.o *.lint
     67        @echo "    Deleting executable and binary files for 'test/collections'"
     68        $(RM) $(OBJS)
    9369
    94 %.o : %.c
    95         $(CC) $(CFLAGS) $(CPPFLAGS) -I.. -I$(PSLIB_INCL_DIR) -c -o $@ $<
    96 
    97 %   : %.o
    98         $(CC) -o $@ $< -L$(PSLIB_LIB_DIR) -lpslib -lpstest -lgsl -lgslcblas $(LDFLAGS)
    99 
    100 ## NOTE: The distclean target does not remove the .o files.  The Makefiles must
    101 ## be repaired.
    102 distclean:
     70distclean: clean
    10371        $(RM) $(TARGET)
    10472
    105 %.lint: %.c
    106         splint +posixlib -exportlocal -realcompare $(INCLUDE_GLOBAL) $? > $@; cat $@
     73install: $(testbindir) $(testbindir)/verified $(TARGET)
     74        install $(TARGET) $(testbindir)
     75        install verified/*.stderr verified/*.stdout $(testbindir)/verified
     76
     77$(testbindir):
     78        mkdir -p $(testbindir)
     79
     80$(testbindir)/verified:
     81        mkdir -p $(testbindir)/verified
    10782
    10883
  • trunk/psLib/test/image/tst_psImage.c

    r1193 r1212  
    66 *  @author Robert DeSonia, MHPCC
    77 *
    8  *  @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2004-07-08 01:05:01 $
     8 *  @version $Revision: 1.21 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2004-07-13 01:37:58 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2424static int testImageSubset(void);
    2525static int testImageCopy(void);
    26 static int testImageClip(void);
    27 static int testImageClipNAN(void);
    28 static int testImageOverlay(void);
    2926
    3027testDescription tests[] = {
     
    3431                              {testImageSubset,550,"psImageSubset",0,true},
    3532                              {testImageCopy,551,"psImageCopy",0,false},
    36                               {testImageClip,571,"psImageClip",0,false},
    37                               {testImageClipNAN,572,"psImageClipNAN",0,false},
    38                               {testImageOverlay,573,"psImageOverlay",0,false},
    3933                              {NULL}
    4034                          };
     
    623617}
    624618
    625 int testImageClip(void)
    626 {
    627     psImage* img = NULL;
    628     unsigned int c = 128;
    629     unsigned int r = 256;
    630     psF32 min;
    631     psF32 max;
    632     int numClipped = 0;
    633     int retVal;
    634 
    635     psLogMsg(__func__,PS_LOG_INFO,
    636              "psImageClip shall limit the minimum and maximum data value within a psImage structure");
    637 
    638     /*
    639 
    640         psImageClip shall limit the minimum and maximum data value within a
    641         psImage structure to a specified min and max value.
    642 
    643         Verify the returned integer is equal to the number of pixels clipped,
    644         if the input psImage structure contains known values and input parameters
    645         min and max have know values.
    646 
    647         Verify the psImage structure specified by the input parameter input is
    648         modified to contain the expected values, if the input psImage structure
    649         contains known values, min and max are specified and vmin and vmax
    650         parameters are known.
    651 
    652         Verify the retuned integer is zero, psImage structure input is unmodified
    653         and program executions doesn't stop, if input parameter psImage structure
    654         pointer is null.
    655 
    656         Verify the retuned integer is zero, psImage structure input is unmodified
    657         and program executions doesn't stop, if input parameter min is larger than max.
    658     */
    659 
    660     // create image
    661     #define testImageClipByType(datatype) \
    662     img = psImageAlloc(c,r,PS_TYPE_##datatype); \
    663     for (unsigned int row=0;row<r;row++) { \
    664         ps##datatype* imgRow = img->data.datatype[row]; \
    665         for (unsigned int col=0;col<c;col++) { \
    666             imgRow[col] = (ps##datatype)(row+col); \
    667         } \
    668     } \
    669     min = (float)r/2.0f; \
    670     max = (float)r; \
    671     \
    672     retVal = psImageClip(img,min,-1.0f,max,-2.0f); \
    673     \
    674     numClipped = 0; \
    675     for (unsigned int row=0;row<r;row++) { \
    676         ps##datatype* imgRow = img->data.datatype[row]; \
    677         for (unsigned int col=0;col<c;col++) { \
    678             ps##datatype value = (ps##datatype)(row+col); \
    679             if (value < (ps##datatype)min) { \
    680                 numClipped++; \
    681                 value = -1; \
    682             } else if (value > (ps##datatype)max) { \
    683                 numClipped++; \
    684                 value = -2; \
    685             } \
    686             if (fabsf(imgRow[col]-value) > FLT_EPSILON) { \
    687                 psError(__func__,"Pixel value is not as expected (%d vs %d) at %u,%u", \
    688                         imgRow[col],value,col,row); \
    689                 return 1; \
    690             } \
    691         } \
    692     } \
    693     if (retVal != numClipped) { \
    694         psError(__func__,"Expected %d clips, but got %d", \
    695                 numClipped,retVal); \
    696         return 2; \
    697     } \
    698     psFree(img);
    699 
    700     #define testImageClipByComplexType(datatype) \
    701     img = psImageAlloc(c,r,PS_TYPE_##datatype); \
    702     for (unsigned int row=0;row<r;row++) { \
    703         ps##datatype* imgRow = img->data.datatype[row]; \
    704         for (unsigned int col=0;col<c;col++) { \
    705             imgRow[col] = (ps##datatype)(row+I*col); \
    706         } \
    707     } \
    708     min = (float)r/2.0f; \
    709     max = (float)r; \
    710     \
    711     retVal = psImageClip(img,min,-1.0f,max,-2.0f); \
    712     \
    713     numClipped = 0; \
    714     for (unsigned int row=0;row<r;row++) { \
    715         ps##datatype* imgRow = img->data.datatype[row]; \
    716         for (unsigned int col=0;col<c;col++) { \
    717             ps##datatype value = row+I*col; \
    718             if (cabs(value) < min) { \
    719                 numClipped++; \
    720                 value = -1.0f; \
    721             } else if (cabs(value) > max) { \
    722                 numClipped++; \
    723                 value = -2.0f; \
    724             } \
    725             if (fabsf(creal(imgRow[col])-creal(value)) > FLT_EPSILON || \
    726                     fabsf(cimag(imgRow[col])-cimag(value)) > FLT_EPSILON) { \
    727                 psError(__func__,"Pixel value is not as expected (%.2f+%.2fi vs %.2f+%.2fi) at %u,%u", \
    728                         creal(imgRow[col]),cimag(imgRow[col]),creal(value),cimag(value),col,row); \
    729                 return 1; \
    730             } \
    731         } \
    732     } \
    733     if (retVal != numClipped) { \
    734         psError(__func__,"Expected %d clips, but got %d", \
    735                 numClipped,retVal); \
    736         return 2; \
    737     } \
    738     psFree(img);
    739 
    740     psLogMsg(__func__,PS_LOG_INFO,"Testing clipping of F64 imagery");
    741     testImageClipByType(F64);
    742     psLogMsg(__func__,PS_LOG_INFO,"Testing clipping of F32 imagery");
    743     testImageClipByType(F32);
    744     psLogMsg(__func__,PS_LOG_INFO,"Testing clipping of S32 imagery");
    745     testImageClipByType(S32);
    746     psLogMsg(__func__,PS_LOG_INFO,"Testing clipping of S16 imagery");
    747     testImageClipByType(S16);
    748     psLogMsg(__func__,PS_LOG_INFO,"Testing clipping of S8 imagery");
    749     testImageClipByType(S8);
    750     psLogMsg(__func__,PS_LOG_INFO,"Testing clipping of U32 imagery");
    751     testImageClipByType(U32);
    752     psLogMsg(__func__,PS_LOG_INFO,"Testing clipping of U16 imagery");
    753     testImageClipByType(U16);
    754     psLogMsg(__func__,PS_LOG_INFO,"Testing clipping of U8 imagery");
    755     testImageClipByType(U8);
    756     psLogMsg(__func__,PS_LOG_INFO,"Testing clipping of C32 imagery");
    757     testImageClipByComplexType(C32);
    758     psLogMsg(__func__,PS_LOG_INFO,"Testing clipping of C64 imagery");
    759     testImageClipByComplexType(C64);
    760 
    761     // Verify the retuned integer is zero, psImage structure input is unmodified
    762     // and program executions doesn't stop, if input parameter psImage structure
    763     // pointer is null.
    764     retVal = psImageClip(NULL,min,-1.0f,max,-2.0f);
    765     if (retVal != 0) {
    766         psError(__func__,"Expected zero return for clips of a NULL image.");
    767         return 3;
    768     }
    769 
    770     // Verify the retuned integer is zero, psImage structure input is unmodified
    771     // and program executions doesn't stop, if input parameter min is larger than max.
    772     psLogMsg(__func__,PS_LOG_INFO,"Following should be an error (max<min)");
    773     retVal = psImageClip(img,max,-1.0f,min,-2.0f);
    774     if (retVal != 0) {
    775         psError(__func__,"Expected zero return for clips when max < min.");
    776         return 4;
    777     }
    778 
    779     return 0;
    780 }
    781 
    782 int testImageClipNAN(void)
    783 {
    784     psImage* img = NULL;
    785     unsigned int c = 128;
    786     unsigned int r = 256;
    787     int numClipped = 0;
    788     int retVal;
    789 
    790     psLogMsg(__func__,PS_LOG_INFO,
    791              "psImageClipNaN shall modified pixel values of NaN with a specified value");
    792 
    793     /*
    794         psImageClipNaN shall modify a psImage structure with pixel values set
    795         to NaN to a value specified as an input parameter.
    796 
    797         Verify the returned integer is equal to the number of pixels modified
    798         and the psImage is modified at locations where NaN pixels where
    799         located to the value specified in the input parameter value.
    800 
    801         Verify the returned integer is zero and program execution doesn't stop,
    802         if the input parameter psImage structure pointer is null.
    803     */
    804 
    805     // create image
    806     #define testImageClipNaNByType(datatype) \
    807     img = psImageAlloc(c,r,PS_TYPE_##datatype); \
    808     for (unsigned row=0;row<r;row++) { \
    809         ps##datatype* imgRow = img->data.datatype[row]; \
    810         for (unsigned col=0;col<c;col++) { \
    811             if (row == col) { \
    812                 imgRow[col] = NAN; \
    813             } else if (row+1 == col) { \
    814                 imgRow[col] = INFINITY; \
    815             } else { \
    816                 imgRow[col] = (ps##datatype)(row+col); \
    817             } \
    818         } \
    819     } \
    820     \
    821     retVal = psImageClipNaN(img,-1.0f); \
    822     \
    823     numClipped = 0; \
    824     for (unsigned row=0;row<r;row++) { \
    825         ps##datatype* imgRow = img->data.datatype[row]; \
    826         for (unsigned col=0;col<c;col++) { \
    827             ps##datatype value = (ps##datatype)(row+col); \
    828             if ( (row == col) || (row+1 == col) ) { \
    829                 numClipped++; \
    830                 value = -1.0; \
    831             } \
    832             if (fabsf(imgRow[col]-value) > FLT_EPSILON) { \
    833                 psError(__func__,"Pixel value is not as expected (%f vs %f) at %d,%d", \
    834                         imgRow[col],value,col,row); \
    835                 return 1; \
    836             } \
    837         } \
    838     } \
    839     if (retVal != numClipped) { \
    840         psError(__func__,"Expected %d clips, but got %d", \
    841                 numClipped,retVal); \
    842         return 2; \
    843     } \
    844     psFree(img);
    845 
    846     testImageClipNaNByType(F32);
    847     testImageClipNaNByType(F64);
    848 
    849     // Verify the retuned integer is zero, psImage structure input is unmodified
    850     // and program executions doesn't stop, if input parameter psImage structure
    851     // pointer is null.
    852     retVal = psImageClipNaN(NULL,-1.0f);
    853     if (retVal != 0) {
    854         psError(__func__,"Expected zero return for clips of a NULL image.");
    855         return 3;
    856     }
    857 
    858     return 0;
    859 }
    860 
    861 int testImageOverlay(void)
    862 {
    863 
    864     psImage* img = NULL;
    865     psImage* img2 = NULL;
    866     unsigned int c = 128;
    867     unsigned int r = 256;
    868     int retVal;
    869 
    870     /*
    871     psImageSectionOverlay shall modified pixel values in a psImage structure to
    872     be equal to the value of the originaldata and an overlay image with a
    873     specified operation. Valid operations include =, +, -, *, /.
    874 
    875     Verify the returned integer is zero
    876     and the input parameter psImage structure is modified at the specified
    877     location and range with the given overlay image and the specified
    878     function. Cases should include all the valid operations. Comparison of
    879     expected values should include a delta to allow for testing on
    880     different platforms.
    881 
    882     */
    883 
    884 
    885 
    886     #define testOverlayTypeOP(DATATYPE,OP,OPSTRING) \
    887     img = psImageAlloc(c,r,PS_TYPE_##DATATYPE); \
    888     for (unsigned row=0;row<r;row++) { \
    889         ps##DATATYPE* imgRow = img->data.DATATYPE[row]; \
    890         for (unsigned col=0;col<c;col++) { \
    891             imgRow[col] = 6.0; \
    892         } \
    893     } \
    894     img2 = psImageAlloc(c/2,r/2,PS_TYPE_##DATATYPE); \
    895     for (unsigned row=0;row<r/2;row++) { \
    896         ps##DATATYPE* img2Row = img2->data.DATATYPE[row]; \
    897         for (unsigned col=0;col<c/2;col++) { \
    898             img2Row[col] = 2.0; \
    899         } \
    900     } \
    901     retVal = psImageOverlaySection(img,img2,c/4,r/4,OPSTRING); \
    902     if (retVal != 0) { \
    903         psError(__func__,"psImageOverlaySection returned non-zero %s op",OPSTRING); \
    904         return 1; \
    905     } \
    906     for (unsigned row=0;row<r;row++) { \
    907         ps##DATATYPE* imgRow = img->data.DATATYPE[row]; \
    908         ps##DATATYPE* img2Row = img2->data.DATATYPE[row]; \
    909         for (unsigned col=0;col<c;col++) { \
    910             ps##DATATYPE val = 6.0; \
    911             if ( ! (row < r/4 || row >= r/2+r/4 || col < c/4 || col >= c/2+c/4)) { \
    912                 val OP 2.0; \
    913             } \
    914             if (fabsf(imgRow[col] - val) > FLT_EPSILON) { \
    915                 psError(__func__,"Value incorrect at %d,%d (%.2f vs %.2f for %s)", \
    916                         col,row,imgRow[col],val,OPSTRING); \
    917                 return 2; \
    918             } \
    919             if (row < r/2 && col < c/2 && fabsf(img2Row[col] - 2.0) > FLT_EPSILON) { \
    920                 psError(__func__,"Overlay modified at %d,%d (%.2f for %s)", \
    921                         col,row,img2Row[col],OPSTRING); \
    922                 return 2; \
    923             } \
    924         } \
    925     } \
    926     psFree(img); \
    927     psFree(img2);
    928 
    929     #define testOverlayType(DATATYPE) \
    930     testOverlayTypeOP(DATATYPE,+=,"+"); \
    931     testOverlayTypeOP(DATATYPE,-=,"-"); \
    932     testOverlayTypeOP(DATATYPE,*=,"*");\
    933     testOverlayTypeOP(DATATYPE,/=,"/");\
    934     testOverlayTypeOP(DATATYPE,=,"=");
    935 
    936     testOverlayType(C64);
    937     testOverlayType(C32);
    938     testOverlayType(F64);
    939     testOverlayType(F32);
    940     testOverlayType(S16);
    941     testOverlayType(S8);
    942     testOverlayType(U16);
    943     testOverlayType(U8);
    944 
    945     /*
    946     Verify the returned integer is equal to non-zero and the input psImage structure
    947     is unmodified, if the overlay specified is not within the data range of the
    948     input psImage structure.
    949     */
    950 
    951     img = psImageAlloc(c,r,PS_TYPE_F32);
    952     for (unsigned row=0;row<r;row++) {
    953         psF32* imgRow = img->data.F32[row];
    954         for (unsigned col=0;col<c;col++) {
    955             imgRow[col] = 6.0f;
    956         }
    957     }
    958     img2 = psImageAlloc(c,r,PS_TYPE_F32);
    959     for (unsigned row=0;row<r;row++) {
    960         psF32* img2Row = img2->data.F32[row];
    961         for (unsigned col=0;col<c;col++) {
    962             img2Row[col] = 2.0f;
    963         }
    964     }
    965 
    966     psLogMsg(__func__,PS_LOG_INFO,"Following should error as overlay isn't within image boundaries");
    967     retVal = psImageOverlaySection(img,img2,c/4,r/4,"+");
    968     if (retVal == 0) {
    969         psError(__func__,"psImageOverlaySection returned zero even though "
    970                 "overlay too big");
    971         return 3;
    972     }
    973     for (unsigned row=0;row<r;row++) {
    974         psF32* imgRow = img->data.F32[row];
    975         for (unsigned col=0;col<c;col++) {
    976             if (imgRow[col] != 6.0f) {
    977                 psError(__func__,"Input image modified when overlay size too big");
    978                 return 4;
    979             }
    980         }
    981     }
    982 
    983     /*
    984     Verify the returned integer is equal to non-zero, the input psImage
    985     structure is unmodified and program execution doesn't stop, if the
    986     overlay specified is null.
    987     */
    988 
    989     psLogMsg(__func__,PS_LOG_INFO,"Following should error as overlay is NULL");
    990     retVal = psImageOverlaySection(img,NULL,c/4,r/4,"+");
    991     if (retVal == 0) {
    992         psError(__func__,"psImageOverlaySection returned zero even though "
    993                 "overlay too big");
    994         return 5;
    995     }
    996     for (unsigned row=0;row<r;row++) {
    997         psF32* imgRow = img->data.F32[row];
    998         for (unsigned col=0;col<c;col++) {
    999             if (imgRow[col] != 6.0f) {
    1000                 psError(__func__,"Input image modified when overlay NULL");
    1001                 return 6;
    1002             }
    1003         }
    1004     }
    1005 
    1006     /*
    1007     Verify the returned integer is equal to non-zero and program execution
    1008     doesn't stop, if the input parameter image is null.
    1009     */
    1010 
    1011     psLogMsg(__func__,PS_LOG_INFO,"Following should error as image input is NULL");
    1012     retVal = psImageOverlaySection(NULL,img2,c/4,r/4,"+");
    1013     if (retVal == 0) {
    1014         psError(__func__,"psImageOverlaySection returned zero even though "
    1015                 "overlay too big");
    1016         return 7;
    1017     }
    1018 
    1019     /*
    1020     Verify program execution doen't stop, if the overly image contains
    1021     zero values with division operation is specified.
    1022     */
    1023     for (unsigned row=0;row<r;row++) {
    1024         psF32* img2Row = img2->data.F32[row];
    1025         for (unsigned col=0;col<c;col++) {
    1026             img2Row[col] = 0.0f;
    1027         }
    1028     }
    1029     retVal = psImageOverlaySection(img,img2,0,0,"/");
    1030     if (retVal != 0) {
    1031         psError(__func__,"psImageOverlaySection returned non-zero when "
    1032                 "checking divide-by-zero.");
    1033         return 8;
    1034     }
    1035 
    1036     psFree(img);
    1037     psFree(img2);
    1038 
    1039     return 0;
    1040 }
  • trunk/psLib/test/image/verified/tst_psImage.stderr

    r1198 r1212  
    100100---> TESTPOINT PASSED (psImage{psImageCopy} | tst_psImage.c)
    101101
    102 /***************************** TESTPOINT ******************************************\
    103 *             TestFile: tst_psImage.c                                              *
    104 *            TestPoint: psImage{psImageClip}                                       *
    105 *             TestType: Positive                                                   *
    106 \**********************************************************************************/
    107 
    108  <DATE> <TIME> |<HOST>|I|  testImageClip|psImageClip shall limit the minimum and maximum data value within a psImage structure
    109  <DATE> <TIME> |<HOST>|I|  testImageClip|Testing clipping of F64 imagery
    110  <DATE> <TIME> |<HOST>|I|  testImageClip|Testing clipping of F32 imagery
    111  <DATE> <TIME> |<HOST>|I|  testImageClip|Testing clipping of S32 imagery
    112  <DATE> <TIME> |<HOST>|I|  testImageClip|Testing clipping of S16 imagery
    113  <DATE> <TIME> |<HOST>|I|  testImageClip|Testing clipping of S8 imagery
    114  <DATE> <TIME> |<HOST>|I|  testImageClip|Testing clipping of U32 imagery
    115  <DATE> <TIME> |<HOST>|I|  testImageClip|Testing clipping of U16 imagery
    116  <DATE> <TIME> |<HOST>|I|  testImageClip|Testing clipping of U8 imagery
    117  <DATE> <TIME> |<HOST>|I|  testImageClip|Testing clipping of C32 imagery
    118  <DATE> <TIME> |<HOST>|I|  testImageClip|Testing clipping of C64 imagery
    119  <DATE> <TIME> |<HOST>|I|  testImageClip|Following should be an error (max<min)
    120  <DATE> <TIME> |<HOST>|E|    psImageClip|psImageClip can not be invoked with max < min.
    121 
    122 ---> TESTPOINT PASSED (psImage{psImageClip} | tst_psImage.c)
    123 
    124 /***************************** TESTPOINT ******************************************\
    125 *             TestFile: tst_psImage.c                                              *
    126 *            TestPoint: psImage{psImageClipNAN}                                    *
    127 *             TestType: Positive                                                   *
    128 \**********************************************************************************/
    129 
    130  <DATE> <TIME> |<HOST>|I|testImageClipNA|psImageClipNaN shall modified pixel values of NaN with a specified value
    131 
    132 ---> TESTPOINT PASSED (psImage{psImageClipNAN} | tst_psImage.c)
    133 
    134 /***************************** TESTPOINT ******************************************\
    135 *             TestFile: tst_psImage.c                                              *
    136 *            TestPoint: psImage{psImageOverlay}                                    *
    137 *             TestType: Positive                                                   *
    138 \**********************************************************************************/
    139 
    140  <DATE> <TIME> |<HOST>|I|testImageOverla|Following should error as overlay isn't within image boundaries
    141  <DATE> <TIME> |<HOST>|E|psImageOverlayS|Overlay image (32,64 -> 159,319) is partially outside of the input image (128 x 256).
    142  <DATE> <TIME> |<HOST>|I|testImageOverla|Following should error as overlay is NULL
    143  <DATE> <TIME> |<HOST>|E|psImageOverlayS|one of the input images was NULL.
    144  <DATE> <TIME> |<HOST>|I|testImageOverla|Following should error as image input is NULL
    145  <DATE> <TIME> |<HOST>|E|psImageOverlayS|one of the input images was NULL.
    146 
    147 ---> TESTPOINT PASSED (psImage{psImageOverlay} | tst_psImage.c)
    148 
  • trunk/psLib/test/runTest

    r1198 r1212  
    3030#
    3131#  $Revison:  $  $Name: not supported by cvs2svn $
    32 #  $Date: 2004-07-08 19:34:18 $
     32#  $Date: 2004-07-13 01:37:58 $
    3333#
    3434#  Copyright 2004 Maui High Performance Computering Center, University of Hawaii
     
    3636################################################################################
    3737
     38# Provides functions for handling long command line options
     39use Getopt::Long;
     40
     41# Assign variables based on the presence of command line options to the script
     42GetOptions("reset!"=>\$reset,
     43           "resetStderr!"=>\$resetStderr,
     44           "resetStdout!"=>\$resetStdout,
     45           "help!"=>\$help);
     46
     47if ($help) {
     48    print "Usage: runTest [--reset] [--resetStderr] [--resetStdout] testfile(s)\n\n";
     49    exit(0);
     50}
     51
     52if ($reset) {
     53    $resetStderr = 1;
     54    $resetStdout = 1;
     55}
     56   
    3857# Initialize exit value
    3958$exitValue = 0;
     
    5574$ENV{'DYLD_LIBRARY_PATH'} = "$ENV{'PSLIB_ROOT'}/lib:$ENV{'DYLD_LIBRARY_PATH'}";
    5675
    57 # Get test driver name from arguement list
    58 $testFile = $ARGV[0];
    59 
    60 # Check if a temp directory already exists in the current work directory
    61 if ( !( -e "temp" )) {
    62    # Create temp directory to store STDOUT, STDERR files during test run
    63    `mkdir temp`;
    64    # Display message of new directory created
    65    print("Creating temp directory\n");
    66 }
    67 
    68 # Check if a verified directory exists in the current work directory
    69 if ( !( -e "verified" )) {
    70     # Display message that verified subdirectory doesn't exist
    71     print("        Verified directory doesn't exist.\n");
    72     # Exit script since the test cannot be run with verified files
    73     $exitValue = 1;
    74 }
    75 
    76 # Check if the test driver file exists and is executable
    77 if ( (-e $testFile) && (-x $testFile) ) {
    78 
    79     # Display message the test driver is being executed
    80     print("--- Executing test driver: $testFile\n");
    81 
    82     # Invoke the test driver
    83     system("./$testFile 1> temp/$testFile.stdout 2> temp/$testFile.stderr");
    84 
    85     # Check the return value of the test driver.  A value other than 0
    86     # indicates failure of the test driver unless the test driver is name
    87     # with a leading 'a' which indicates the test driver is expecting an
    88     # abort condition to terminate the driver.
    89     if ( ( $? != 0  && ( $testFile !~ /^A/i)) ||
    90          ( $? == 0  && ( $testFile =~ /^A/i)) ) {
    91 
    92         # Display failure message with return value to user
    93         if ( $? != 0 && ( $testFile !~ /^A/i) ) {
    94             print("        Failed - Test Driver expected 0 return value (Return value $?)\n");
    95         } elsif ( $? == 0 && ( $testFile =~ /^A/i) ) {
    96             print("        Failed - Test Driver expected abort (Return value $?)\n");
     76# Loop through the arguements passed to the script
     77foreach (@ARGV) {
     78    chomp;
     79    $testFile = $_;
     80
     81    # Check if a temp directory already exists in the current work directory
     82    if ( !( -e "temp" )) {
     83    # Create temp directory to store STDOUT, STDERR files during test run
     84    `mkdir temp`;
     85    # Display message of new directory created
     86    print("Creating temp directory\n");
     87    }
     88   
     89    # Check if a verified directory exists in the current work directory
     90    if ( !( -e "verified" )) {
     91        # Display message that verified subdirectory doesn't exist
     92        print("        Verified directory doesn't exist.\n");
     93        # Exit script since the test cannot be run with verified files
     94        $exitValue = 1;
     95    }
     96   
     97    # Check if the test driver file exists and is executable
     98    if ( (-e $testFile) && (-x $testFile) ) {
     99   
     100        # Display message the test driver is being executed
     101        print("--- Executing test driver: $testFile\n");
     102   
     103        # Invoke the test driver
     104        system("./$testFile 1> temp/$testFile.stdout 2> temp/$testFile.stderr");
     105       
     106        # Check the return value of the test driver.  A value other than 0
     107        # indicates failure of the test driver unless the test driver is name
     108        # with a leading 'a' which indicates the test driver is expecting an
     109        # abort condition to terminate the driver.
     110        if ( ( $? != 0  && ( $testFile !~ /^A/i)) ||
     111            ( $? == 0  && ( $testFile =~ /^A/i)) ) {
     112   
     113            # Display failure message with return value to user
     114            if ( $? != 0 && ( $testFile !~ /^A/i) ) {
     115                print("        Failed - Test Driver expected 0 return value (Return value $?)\n");
     116            } elsif ( $? == 0 && ( $testFile =~ /^A/i) ) {
     117                print("        Failed - Test Driver expected abort (Return value $?)\n");
     118            }
     119            $exitValue |= 256;
     120        } else {
     121   
     122            # Test driver succeeded.
     123   
     124            # Create filtered version of stdout and stderr
     125               
     126            # Open the STDOUT file for reading       
     127            open(OUTFILE, "< temp/$testFile.stdout");
     128            # Open mod file to place filtered STDOUT
     129            open(MODFILE, "> temp/$testFile.stdout.mod");
     130            open(MODFILE2, "> verified/$testFile.stdout") if $resetStdout;
     131            # Replace the variable date, time and host information with constants
     132            $hostname = `hostname`;
     133            chop $hostname;
     134            while( <OUTFILE> ) {
     135                s/\d+:\d+:\d+/ <DATE> /;
     136                s/\s+\d+:\d+:\d+\w/ <TIME> /;
     137                s/$hostname/<HOST>/;
     138                # Filter lines with malloc.  This is an artifact of memory testing
     139                # with the Mac testbed
     140                if ( ! m/\*\*\*\smalloc/ ) {
     141                print MODFILE ($_);
     142                print MODFILE2 ($_) if $resetStdout;
     143                }
     144            }
     145            # Close mod file
     146            close(MODFILE);
     147            close(MODFILE2) if $resetStdout;
     148            # Close STDERR file
     149            close(OUTFILE);
     150   
     151            # Open the STDERR file for reading
     152            open(OUTFILE, "< temp/$testFile.stderr");
     153            # Open mod file to place filtered STDERR
     154            open(MODFILE, "> temp/$testFile.stderr.mod");
     155            open(MODFILE2, "> verified/$testFile.stderr") if $resetStderr;
     156            # Replace the variable date, time and host information with constants
     157            while( <OUTFILE> ) {
     158                s/\d+:\d+:\d+/ <DATE> /;
     159                s/\s+\d+:\d+:\d+\w/ <TIME> /;
     160                s/$hostname/<HOST>/;
     161                # Filter lines with malloc.  This is an artifact of memory testing
     162                # with the Mac testbed
     163                if ( ! m/\*\*\*\smalloc/ ) {
     164                print MODFILE ($_);
     165                print MODFILE2 ($_) if $resetStderr;
     166                }
     167            }
     168            # Close mod file
     169            close(MODFILE);
     170            close(MODFILE2) if $resetStderr;
     171            # Close STDERR file
     172            close(OUTFILE);
     173   
     174            # Compare STDOUT capture with verified file
     175            $exitValue |= &compareStream("verified/$testFile.stdout");
     176   
     177            # Check exit value to determine if verified file doesn't exist
     178            if ( $exitValue & 2 ) {
     179   
     180                # STDOUT verified doesn't exist.  Search STDOUT capture
     181                # for strings indicating error or failure
     182                $exitValue |= &errorStrSearch("$testFile.stdout");
     183            }
     184   
     185            # Compare STDERR capture with verified file
     186            $exitValue |= &compareStream("verified/$testFile.stderr");
     187   
     188            # Check exit value to determine if verified file doesn't exist
     189            if ( $exitValue & 4 ) {
     190   
     191                # STDERR verified doesn't exist.  Search STDERR capture
     192                # for strings indicating error or failure
     193                $exitValue |= &errorStrSearch("$testFile.stderr");
     194            }
    97195        }
    98         $exitValue |= 256;
    99196    } else {
    100  
    101         # Test driver succeeded.
    102  
    103         # Create filtered version of stdout and stderr
    104      
    105         # Open the STDOUT file for reading
    106         open(OUTFILE, "< temp/$testFile.stdout");
    107         # Open mod file to place filtered STDOUT
    108         open(MODFILE, ">temp/$testFile.stdout.mod");
    109         # Replace the variable date, time and host information with constants
    110         $hostname = `hostname`;
    111         chop $hostname;
    112         while( <OUTFILE> ) {
    113             s/\d+:\d+:\d+/ <DATE> /;
    114             s/\s+\d+:\d+:\d+\w/ <TIME> /;
    115             s/$hostname/<HOST>/;
    116             # Filter lines with malloc.  This is an artifact of memory testing
    117             # with the Mac testbed
    118             if ( ! m/\*\*\*\smalloc/ ) {
    119                print MODFILE ($_);
    120             }
    121         }
    122         # Close mod file
    123         close(MODFILE);
    124         # Close STDERR file
    125         close(OUTFILE);
    126 
    127         # Open the STDERR file for reading
    128         open(OUTFILE, "< temp/$testFile.stderr");
    129         # Open mod file to place filtered STDERR
    130         open(MODFILE, "> temp/$testFile.stderr.mod");
    131         # Replace the variable date, time and host information with constants
    132         while( <OUTFILE> ) {
    133             s/\d+:\d+:\d+/ <DATE> /;
    134             s/\s+\d+:\d+:\d+\w/ <TIME> /;
    135             s/$hostname/<HOST>/;
    136             # Filter lines with malloc.  This is an artifact of memory testing
    137             # with the Mac testbed
    138             if ( ! m/\*\*\*\smalloc/ ) {
    139                print MODFILE ($_);
    140             }
    141         }
    142         # Close mod file
    143         close(MODFILE);
    144         # Close STDERR file
    145         close(OUTFILE);
    146 
    147         # Compare STDOUT capture with verified file
    148         $exitValue |= &compareStream("verified/$testFile.stdout");
    149 
    150         # Check exit value to determine if verified file doesn't exist
    151         if ( $exitValue & 2 ) {
    152 
    153             # STDOUT verified doesn't exist.  Search STDOUT capture
    154             # for strings indicating error or failure
    155             $exitValue |= &errorStrSearch("$testFile.stdout");
    156         }
    157 
    158         # Compare STDERR capture with verified file
    159         $exitValue |= &compareStream("verified/$testFile.stderr");
    160 
    161         # Check exit value to determine if verified file doesn't exist
    162         if ( $exitValue & 4 ) {
    163 
    164             # STDERR verified doesn't exist.  Search STDERR capture
    165             # for strings indicating error or failure
    166             $exitValue |= &errorStrSearch("$testFile.stderr");
    167         }
    168     }
    169 } else {
    170     # Since test driver doesn't exist or is not executable then display
    171     # message to user.
    172     print("        Need to specify an executable test file within directory.\n");
    173    
    174     # Exit value set to indicate test driver doesn't exist or not executable
    175     $exitValue |= 32;
     197        # Since test driver doesn't exist or is not executable then display
     198        # message to user.
     199        print("        Need to specify an executable test file within directory.\n");
     200       
     201        # Exit value set to indicate test driver doesn't exist or not executable
     202        $exitValue |= 32;
     203    }
    176204}
    177205
  • trunk/psLib/test/sysUtils/Makefile

    r1109 r1212  
    33##  Makefile:   test/sysUtils
    44##
    5 ##  $Revision: 1.16 $  $Name: not supported by cvs2svn $
    6 ##  $Date: 2004-06-26 03:05:12 $
     5##  $Revision: 1.17 $  $Name: not supported by cvs2svn $
     6##  $Date: 2004-07-13 01:37:59 $
    77##
    88##  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    1616include ../../src/Makefile.Globals
    1717
    18 PSLIB_INCL_DIR = ../../include
    19 
    20 PSLIB_LIB_DIR = ../../lib
     18CFLAGS := -I../../include $(CFLAGS)
     19LDFLAGS := -L../../lib -lpslib -lpstest $(LDFLAGS)
    2120
    2221TARGET = atst_psAbort_01  \
     
    4140         tst_psTrace04
    4241
    43 DEPENDENCIES = $(addprefix builddir/,$(addsuffix .d,$(TARGET)))
    44 OBJS = $(addprefix builddir/,$(addsuffix .o,$(TARGET)))
     42OBJS = $(addsuffix .o,$(TARGET))
    4543
    46 all: builddir $(TARGET)
    47 
    48 builddir:
    49         mkdir builddir
    50 
    51 include $(DEPENDENCIES)
     44all: $(TARGET)
    5245
    5346clean:
    54         @echo "    Deleting executable and binary files for 'test/sysUtils'"
    55         $(RM) $(OBJS) *.lint
     47        @echo "    Deleting executable and binary files for 'test/collections'"
     48        $(RM) $(OBJS)
    5649
    5750distclean: clean
    5851        $(RM) $(TARGET)
    59 
    60 cleandependencies:
    61         $(RM) $(DEPENDENCIES)
    62 
    63 builddir/%.o : %.c
    64         $(CC) $(CFLAGS) $(CPPFLAGS) -I.. -I$(PSLIB_INCL_DIR) -c -o $@ $<
    65 
    66 %   : builddir/%.o
    67         $(CC) -o $@ $< -L$(PSLIB_LIB_DIR) -lpslib -lpstest $(LDFLAGS)
    68 
    69 %.lint: %.c
    70         splint +posixlib -exportlocal -realcompare $(INCLUDE_GLOBAL) $? > $@; cat $@
    71 
    72 builddir/%.d: %.c
    73         $(CC) -MM $(CFLAGS) -I$(PSLIB_INCL_DIR) $< | sed 's|\(.*\.o\)|builddir/\1|' > $@
    7452
    7553install: $(testbindir) $(testbindir)/verified $(TARGET)
     
    8361        mkdir -p $(testbindir)/verified
    8462
     63
Note: See TracChangeset for help on using the changeset viewer.