Index: trunk/psLib/test/imageops/tap_psImagePixelExtract.c
===================================================================
--- trunk/psLib/test/imageops/tap_psImagePixelExtract.c	(revision 13042)
+++ trunk/psLib/test/imageops/tap_psImagePixelExtract.c	(revision 13123)
@@ -6,6 +6,6 @@
 *  @author Robert DeSonia, MHPCC
 *
-*  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2007-04-26 22:18:03 $
+*  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2007-05-02 04:14:33 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -17,5 +17,5 @@
 #include "pstap.h"
 
-psS32 main( psS32 argc, char* argv[] )
+psS32 main(psS32 argc, char* argv[])
 {
     psLogSetFormat("HLNM");
@@ -23,5 +23,5 @@
     plan_tests(248);
 
-    // testImageSlice()
+    // test psImageSlice()
     {
         psMemId id = psMemGetId();
@@ -31,7 +31,7 @@
         const psS32 n = r / 4 -1;
         psImage* image;
-        psPixels* positions = psPixelsAlloc( r );
-        psImage* mask = psImageAlloc( c, r, PS_TYPE_MASK );
-        psStats* stat = psStatsAlloc( PS_STAT_SAMPLE_MEDIAN );
+        psPixels* positions = psPixelsAlloc(r);
+        psImage* mask = psImageAlloc(c, r, PS_TYPE_MASK);
+        psStats* stat = psStatsAlloc(PS_STAT_SAMPLE_MEDIAN);
     
 
@@ -46,8 +46,8 @@
         // cases should be used for each possible direction. Data region cases
         // should include 0x0, 1x1, Nx1, 1xN, NxN, MxN
-        for ( psS32 row = 0;row < r;row++ ) {
+        for (psS32 row = 0;row < r;row++) {
             psMaskType* maskRow = mask->data.PS_TYPE_MASK_DATA[row];
-            for ( psS32 col = 0;col < c;col++ ) {
-                maskRow[ col ] = 0;
+            for (psS32 col = 0;col < c;col++) {
+                maskRow[col] = 0;
             }
         }
@@ -58,10 +58,10 @@
             psVector* out = NULL; \
             bool errorFlag = false; \
-            image = psImageAlloc( c, r, PS_TYPE_##TYPE ); \
-            for ( psS32 row = 0;row < r;row++ ) { \
-                ps##TYPE *imageRow = image->data.TYPE[ row ]; \
+            image = psImageAlloc(c, r, PS_TYPE_##TYPE); \
+            for (psS32 row = 0;row < r;row++) { \
+                ps##TYPE *imageRow = image->data.TYPE[row]; \
                 ps##TYPE rowOffset = row * 2; \
-                for ( psS32 col = 0;col < c;col++ ) { \
-                    imageRow[ col ] = col + rowOffset; \
+                for (psS32 col = 0;col < c;col++) { \
+                    imageRow[col] = col + rowOffset; \
                 } \
             } \
@@ -111,23 +111,23 @@
         //
         #define PSIMAGESLICE_TEST(TYPE) \
-        PSIMAGESLICE_TEST1(TYPE, m, n, PS_CUT_X_POS, m, i, n / 2, 0 ); \
-        PSIMAGESLICE_TEST1(TYPE, m, n, PS_CUT_X_NEG, m, m - 1 - i, n / 2, 1 ); \
-        PSIMAGESLICE_TEST1(TYPE, m, n, PS_CUT_Y_POS, n, m / 2, i, 2 ); \
-        PSIMAGESLICE_TEST1(TYPE, m, n, PS_CUT_Y_NEG, n, m / 2, n - 1 - i, 3 ); \
+        PSIMAGESLICE_TEST1(TYPE, m, n, PS_CUT_X_POS, m, i, n / 2, 0); \
+        PSIMAGESLICE_TEST1(TYPE, m, n, PS_CUT_X_NEG, m, m - 1 - i, n / 2, 1); \
+        PSIMAGESLICE_TEST1(TYPE, m, n, PS_CUT_Y_POS, n, m / 2, i, 2); \
+        PSIMAGESLICE_TEST1(TYPE, m, n, PS_CUT_Y_NEG, n, m / 2, n - 1 - i, 3); \
         \
-        PSIMAGESLICE_TEST1(TYPE, m, 1, PS_CUT_X_POS, m, i, 0, 4 ); \
-        PSIMAGESLICE_TEST1(TYPE, m, 1, PS_CUT_X_NEG, m, m - 1 - i, 0, 5 ); \
-        PSIMAGESLICE_TEST1(TYPE, m, 1, PS_CUT_Y_POS, 1, m / 2, 0, 6 ); \
-        PSIMAGESLICE_TEST1(TYPE, m, 1, PS_CUT_Y_NEG, 1, m / 2, 0, 7 ); \
+        PSIMAGESLICE_TEST1(TYPE, m, 1, PS_CUT_X_POS, m, i, 0, 4); \
+        PSIMAGESLICE_TEST1(TYPE, m, 1, PS_CUT_X_NEG, m, m - 1 - i, 0, 5); \
+        PSIMAGESLICE_TEST1(TYPE, m, 1, PS_CUT_Y_POS, 1, m / 2, 0, 6); \
+        PSIMAGESLICE_TEST1(TYPE, m, 1, PS_CUT_Y_NEG, 1, m / 2, 0, 7); \
         \
-        PSIMAGESLICE_TEST1(TYPE, 1, n, PS_CUT_X_POS, 1, 0, n / 2, 8 ); \
-        PSIMAGESLICE_TEST1(TYPE, 1, n, PS_CUT_X_NEG, 1, 0, n / 2, 9 ); \
-        PSIMAGESLICE_TEST1(TYPE, 1, n, PS_CUT_Y_POS, n, 0, i, 10 ); \
-        PSIMAGESLICE_TEST1(TYPE, 1, n, PS_CUT_Y_NEG, n, 0, n - 1 - i, 11 ); \
+        PSIMAGESLICE_TEST1(TYPE, 1, n, PS_CUT_X_POS, 1, 0, n / 2, 8); \
+        PSIMAGESLICE_TEST1(TYPE, 1, n, PS_CUT_X_NEG, 1, 0, n / 2, 9); \
+        PSIMAGESLICE_TEST1(TYPE, 1, n, PS_CUT_Y_POS, n, 0, i, 10); \
+        PSIMAGESLICE_TEST1(TYPE, 1, n, PS_CUT_Y_NEG, n, 0, n - 1 - i, 11); \
         \
-        PSIMAGESLICE_TEST1(TYPE, 1, 1, PS_CUT_X_POS, 1, 0, 0, 12 ); \
-        PSIMAGESLICE_TEST1(TYPE, 1, 1, PS_CUT_X_NEG, 1, 0, 0, 13 ); \
-        PSIMAGESLICE_TEST1(TYPE, 1, 1, PS_CUT_Y_POS, 1, 0, 0, 14 ); \
-        PSIMAGESLICE_TEST1(TYPE, 1, 1, PS_CUT_Y_NEG, 1, 0, 0, 15 ); \
+        PSIMAGESLICE_TEST1(TYPE, 1, 1, PS_CUT_X_POS, 1, 0, 0, 12); \
+        PSIMAGESLICE_TEST1(TYPE, 1, 1, PS_CUT_X_NEG, 1, 0, 0, 13); \
+        PSIMAGESLICE_TEST1(TYPE, 1, 1, PS_CUT_Y_POS, 1, 0, 0, 14); \
+        PSIMAGESLICE_TEST1(TYPE, 1, 1, PS_CUT_Y_NEG, 1, 0, 0, 15); \
     
         PSIMAGESLICE_TEST(F32);
@@ -149,5 +149,5 @@
                            psRegionSet(c/10, c/10 + 1, r/10, r/10 + 1),
                            PS_CUT_X_POS,
-                           stat );
+                           stat);
         ok(out == NULL, "psImageSlice() returned NULL with NULL input");
     
@@ -156,12 +156,12 @@
         // Following should be an error
         // XXX: Verify error
-        out = psImageSlice( out,
+        out = psImageSlice(out,
                             NULL, image,
                             mask, 1,
                             psRegionSet(c/10, c/10 + 1, r/10, r/10 + 1),
                             PS_CUT_X_POS,
-                            NULL );
+                            NULL);
         ok(out == NULL, "psImageSlice() returned NULL with NULL psStats");
-            psError( PS_ERR_UNKNOWN,true, "Giving a NULL stat struct, psImageSlice didn't return NULL as expected" );
+            psError(PS_ERR_UNKNOWN,true, "Giving a NULL stat struct, psImageSlice didn't return NULL as expected");
 
         // Verify the returned psVector structure pointer is null and program
@@ -182,5 +182,5 @@
         // Following should be an error
         // XXX: Verify error
-        out = psImageSlice( out,
+        out = psImageSlice(out,
                             NULL,
                             image,
@@ -188,5 +188,5 @@
                             psRegionSet(c/10, c/10, r/10, r/10),
                             PS_CUT_X_POS,
-                            stat );
+                            stat);
         ok(out == NULL, "psImageSlice() returned NULL with 0x0 region");
     
@@ -196,25 +196,25 @@
         // Following should be an error
         // XXX: Verify error
-        out = psImageSlice( out, NULL,
+        out = psImageSlice(out, NULL,
                             image,
                             mask, 1,
                             psRegionSet(c+1, c+2, r/10, r/10 + 10),
                             PS_CUT_X_POS,
-                            stat );
+                            stat);
         ok(out == NULL, "psImageSlice() returned NULL with unallowed x position");
     
         // Following should be an error
         // XXX: Verify error
-        out = psImageSlice( out, NULL,
+        out = psImageSlice(out, NULL,
                             image,
                             mask, 1,
                             psRegionSet(c/10, c/10 + 1, r+1,r+5),
                             PS_CUT_X_POS,
-                            stat );
+                            stat);
         ok(out == NULL, "psImageSlice() returned NULL with unallowed y position");
     
         // Following should be an error
         // XXX: Verify error
-        out = psImageSlice( out, NULL,
+        out = psImageSlice(out, NULL,
                             image,
                             mask, 1,
@@ -226,5 +226,5 @@
         // Following should be an error
         // XXX: Verify error
-        out = psImageSlice( out, NULL,
+        out = psImageSlice(out, NULL,
                             image,
                             mask, 1,
@@ -240,5 +240,5 @@
         // XXX: Verify error
         stat->options = 0;
-        out = psImageSlice( out, NULL,
+        out = psImageSlice(out, NULL,
                             image,
                             mask, 1,
@@ -253,6 +253,6 @@
         // XXX: Verify error
         stat->options = PS_STAT_SAMPLE_MEDIAN;
-        psImage* maskSz = psImageAlloc( r, c, PS_TYPE_MASK );
-        out = psImageSlice( out, NULL,
+        psImage* maskSz = psImageAlloc(r, c, PS_TYPE_MASK);
+        out = psImageSlice(out, NULL,
                             image,
                             maskSz, 1,
@@ -265,6 +265,6 @@
         // Following should be an error unallowed mask type
         // XXX: Verify error
-        psImage* maskS8 = psImageAlloc( c, r, PS_TYPE_S8 );
-        out =  psImageSlice( out, NULL,
+        psImage* maskS8 = psImageAlloc(c, r, PS_TYPE_S8);
+        out =  psImageSlice(out, NULL,
                              image,
                              maskS8, 1,
@@ -276,10 +276,10 @@
         //Added tests after subimage changes.
         psFree(image);
-        image = psImageAlloc( c, r, PS_TYPE_F64 );
-        for ( psS32 row = 0;row < r;row++ ) {
-            psF64 *imageRow = image->data.F64[ row ];
+        image = psImageAlloc(c, r, PS_TYPE_F64);
+        for (psS32 row = 0;row < r;row++) {
+            psF64 *imageRow = image->data.F64[row];
             psF64 rowOffset = row * 2;
-            for ( psS32 col = 0;col < c;col++ ) {
-                imageRow[ col ] = col + rowOffset;
+            for (psS32 col = 0;col < c;col++) {
+                imageRow[col] = col + rowOffset;
             }
         }
@@ -441,10 +441,10 @@
                     float y = (float)startRow[n]+(float)i*deltaRow;
                     if (n == 1) {
-//                        truth = psImagePixelInterpolate( image, x, y,
+//                        truth = psImagePixelInterpolate(image, x, y,
 //                                                         NULL,0,0,PS_INTERPOLATE_FLAT);
                           psImageInterpolate(&imgVal, &varVal, &maskVal, x, y, tmpIntOptsNoMask);
                           truth = imgVal;
                     } else {
-//                        truth = psImagePixelInterpolate( image, x, y,
+//                        truth = psImagePixelInterpolate(image, x, y,
 //                                                         mask,1,0,PS_INTERPOLATE_FLAT);
                           psImageInterpolate(&imgVal, &varVal, &maskVal, x, y, tmpIntOptsMask);
@@ -520,5 +520,5 @@
 
 
-    // testImageRadialCut()
+    // test psImageRadialCut()
     {
         psMemId id = psMemGetId();
@@ -557,5 +557,5 @@
                 if (fabs(result->data.F64[i] - (15.0+i*10)) > 1) {
                     diag("Result was not as expected for radii #%d (%g, expected %d +/- 1)",
-                          result->data.F64[i], (15.0+i*10) );
+                          result->data.F64[i], (15.0+i*10));
                     errorFlag = true;
                 }
@@ -574,5 +574,5 @@
                 if (fabs(result->data.F64[i] - (15.0+i*10)) > 1) {
                     diag("Result was not as expected for radii #%d (%g, expected %d +/- 1)",
-                          result->data.F64[i], (15.0+i*10) );
+                          result->data.F64[i], (15.0+i*10));
                     errorFlag = true;
                 }
@@ -709,17 +709,16 @@
         // Following should generate error message(for row)
         // XXX: Verify error
-        out = psImageRow(NULL, image, num);
+        out = psImageRow(NULL, NULL, num);
         ok(out == NULL, "psImageRow() returned NULL with NULL input image");
 
         // Following should generate error message(for col)
         // XXX: Verify error
-        out = psImageCol(NULL, image, num);
+        out = psImageCol(NULL, NULL, num);
         ok(out == NULL, "psImagecol() returned NULL with NULL input image");
-    
         image = psImageAlloc(3, 3, PS_TYPE_F64);
 
 
         //Test for unallowed row0.
-        *(psS32*)&(image->row0) = -1;
+        P_PSIMAGE_SET_ROW0(image, -2);
         // Following should generate error message(for row)
         // XXX: Verify error
@@ -810,4 +809,5 @@
     
         //Test valid cases.
+        //XXX: We do not verify the data values.
         P_PSIMAGE_SET_COL0(image, 10);
         P_PSIMAGE_SET_ROW0(image, 5);
@@ -875,5 +875,5 @@
     
         //Test for error with NULL image
-        empty = psImageCol(empty, emptyImage, 0);
+        empty = psImageCol(empty, NULL, 0);
         ok(empty == NULL, "psImageCol returned NULL for NULL image input");
         //Test for error with Out of Range Row
@@ -894,5 +894,5 @@
         test1 = fabs(rowcol->data.F64[0]-66.6);
         test2 = fabs(rowcol->data.F64[2]-666.66);
-        ok(!( (test1>TOLTST) || (test2>TOLTST)),
+        ok(!((test1>TOLTST) || (test2>TOLTST)),
            "psImageRow returned correct values");
         psFree(rowcol);
