Index: trunk/psLib/test/image/tst_psImage.c
===================================================================
--- trunk/psLib/test/image/tst_psImage.c	(revision 981)
+++ trunk/psLib/test/image/tst_psImage.c	(revision 1033)
@@ -6,6 +6,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-06-10 18:48:35 $
+ *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-06-14 23:03:43 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -43,5 +43,6 @@
     testImageOverlay();
     if (! runTestSuite(stderr,"psImage",tests)) {
-        psAbort(__FILE__,"One or more tests failed");
+        psError(__FILE__,"One or more tests failed");
+        return 1;
     }
     return 0;
@@ -642,7 +643,7 @@
     #define testImageClipByType(datatype) \
     img = psImageAlloc(c,r,PS_TYPE_##datatype); \
-    for (unsigned row=0;row<r;row++) { \
+    for (unsigned int row=0;row<r;row++) { \
         ps##datatype* imgRow = img->data.datatype[row]; \
-        for (unsigned col=0;col<c;col++) { \
+        for (unsigned int col=0;col<c;col++) { \
             imgRow[col] = (ps##datatype)(row+col); \
         } \
@@ -654,7 +655,7 @@
     \
     numClipped = 0; \
-    for (unsigned row=0;row<r;row++) { \
+    for (unsigned int row=0;row<r;row++) { \
         ps##datatype* imgRow = img->data.datatype[row]; \
-        for (unsigned col=0;col<c;col++) { \
+        for (unsigned int col=0;col<c;col++) { \
             ps##datatype value = (ps##datatype)(row+col); \
             if (value < (ps##datatype)min) { \
@@ -666,5 +667,5 @@
             } \
             if (fabsf(imgRow[col]-value) > FLT_EPSILON) { \
-                psError(__func__,"Pixel value is not as expected (%d vs %d) at %d,%d", \
+                psError(__func__,"Pixel value is not as expected (%d vs %d) at %u,%u", \
                         imgRow[col],value,col,row); \
                 return 1; \
@@ -679,14 +680,64 @@
     psImageFree(img);
 
+    #define testImageClipByComplexType(datatype) \
+    img = psImageAlloc(c,r,PS_TYPE_##datatype); \
+    for (unsigned int row=0;row<r;row++) { \
+        ps##datatype* imgRow = img->data.datatype[row]; \
+        for (unsigned int col=0;col<c;col++) { \
+            imgRow[col] = (ps##datatype)(row+I*col); \
+        } \
+    } \
+    min = (float)r/2.0f; \
+    max = (float)r; \
+    \
+    retVal = psImageClip(img,min,-1.0f,max,-2.0f); \
+    \
+    numClipped = 0; \
+    for (unsigned int row=0;row<r;row++) { \
+        ps##datatype* imgRow = img->data.datatype[row]; \
+        for (unsigned int col=0;col<c;col++) { \
+            ps##datatype value = row+I*col; \
+            if (cabs(value) < min) { \
+                numClipped++; \
+                value = -1.0f; \
+            } else if (cabs(value) > max) { \
+                numClipped++; \
+                value = -2.0f; \
+            } \
+            if (fabsf(creal(imgRow[col])-creal(value)) > FLT_EPSILON || \
+                    fabsf(cimag(imgRow[col])-cimag(value)) > FLT_EPSILON) { \
+                psError(__func__,"Pixel value is not as expected (%.2f+%.2fi vs %.2f+%.2fi) at %u,%u", \
+                        creal(imgRow[col]),cimag(imgRow[col]),creal(value),cimag(value),col,row); \
+                return 1; \
+            } \
+        } \
+    } \
+    if (retVal != numClipped) { \
+        psError(__func__,"Expected %d clips, but got %d", \
+                numClipped,retVal); \
+        return 2; \
+    } \
+    psImageFree(img);
+
+    psLogMsg(__func__,PS_LOG_INFO,"Testing clipping of F64 imagery");
     testImageClipByType(F64);
+    psLogMsg(__func__,PS_LOG_INFO,"Testing clipping of F32 imagery");
     testImageClipByType(F32);
-    testImageClipByType(S64);
+    psLogMsg(__func__,PS_LOG_INFO,"Testing clipping of S32 imagery");
     testImageClipByType(S32);
+    psLogMsg(__func__,PS_LOG_INFO,"Testing clipping of S16 imagery");
     testImageClipByType(S16);
+    psLogMsg(__func__,PS_LOG_INFO,"Testing clipping of S8 imagery");
     testImageClipByType(S8);
-    testImageClipByType(U64);
+    psLogMsg(__func__,PS_LOG_INFO,"Testing clipping of U32 imagery");
     testImageClipByType(U32);
+    psLogMsg(__func__,PS_LOG_INFO,"Testing clipping of U16 imagery");
     testImageClipByType(U16);
+    psLogMsg(__func__,PS_LOG_INFO,"Testing clipping of U8 imagery");
     testImageClipByType(U8);
+    psLogMsg(__func__,PS_LOG_INFO,"Testing clipping of C32 imagery");
+    testImageClipByComplexType(C32);
+    psLogMsg(__func__,PS_LOG_INFO,"Testing clipping of C64 imagery");
+    testImageClipByComplexType(C64);
 
     // Verify the retuned integer is zero, psImage structure input is unmodified
