Index: trunk/psLib/test/image/tst_psImage.c
===================================================================
--- trunk/psLib/test/image/tst_psImage.c	(revision 1682)
+++ trunk/psLib/test/image/tst_psImage.c	(revision 1920)
@@ -6,6 +6,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.25 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-09-02 21:17:03 $
+ *  @version $Revision: 1.26 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-09-28 23:26:49 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -26,22 +26,10 @@
 
 testDescription tests[] = {
-                              {
-                                  testImageAlloc,546,"psImageAlloc",0,false
-                              },
-                              {
-                                  testImageAlloc,548,"psImageFree",0,true
-                              },
-                              {
-                                  testImageSubset,547,"psImageSubset",0,false
-                              },
-                              {
-                                  testImageSubset,550,"psImageSubset",0,true
-                              },
-                              {
-                                  testImageCopy,551,"psImageCopy",0,false
-                              },
-                              {
-                                  NULL
-                              }
+                              {testImageAlloc,546,"psImageAlloc",0,false},
+                              {testImageAlloc,548,"psImageFree",0,true},
+                              {testImageSubset,547,"psImageSubset",0,false},
+                              {testImageSubset,550,"psImageSubset",0,true},
+                              {testImageCopy,551,"psImageCopy",0,false},
+                              {NULL}
                           };
 
@@ -119,12 +107,6 @@
             }
 
-            if (image->nChildren != 0) {
-                psError(__func__,"psImageAlloc returned non-zero number of children");
-                psFree(image);
-                return 6;
-            }
-
             if (image->children != NULL) {
-                psError(__func__,"psImageAlloc returned non-NULL children vector");
+                psError(__func__,"psImageAlloc returned non-NULL children array");
                 psFree(image);
                 return 7;
@@ -259,19 +241,13 @@
                 }
             }
-
-            // #548: Verify no memory leaks or corruption are detected after a valid psImage structure with no
-            // children is freed.
             psFree(image);
         }
     }
 
-    // #548: Verify program execution doesn't stop, if the input psImage structure pointer is null.
-    psFree(NULL);
-
     // #548: Verify no memory leaks or corruption are detected after a valid psImage structure with multiple
-    // children isfreed.
+    // children is freed.
     image = psImageAlloc(100,100,PS_TYPE_F32);
-    psImageSubset(image,50,50,0,0);
-    psImageSubset(image,50,50,20,20);
+    psImageSubset(image,50,0,70,20);
+    psImageSubset(image,70,20,90,40);
 
     psFree(image);
@@ -300,7 +276,22 @@
     memcpy(&preSubsetStruct,original,sizeof(psImage));
 
-    subset2 = psImageSubset(original,c/2,r/2,c/4,r/4);
-
-    subset3 = psImageSubset(original,c/2,r/2,0,0);
+    subset2 = psImageSubset(original,c/4,r/4,c/4+c/2,r/4+r/2);
+
+    subset3 = psImageSubset(original,0,0,c/2,r/2);
+
+    psLogMsg(__func__,PS_LOG_INFO,"Verify the returned psImage structure members nrow and ncol are equal to "
+             "the input parameter nrow and ncol respectively.");
+
+    if (subset2->numCols != c/2 || subset2->numRows != r/2) {
+        psError(__func__,"psImageSubset output size was not proper(%dx%d, should be %dx%d).",
+                subset2->numCols, subset2->numRows, c/2,r/2);
+        return 1;
+    }
+
+    if (subset3->numCols != c/2 || subset3->numRows != r/2) {
+        psError(__func__,"psImageSubset output size was not proper(%dx%d, should be %dx%d).",
+                subset3->numCols, subset3->numRows, c/2,r/2);
+        return 2;
+    }
 
     psLogMsg(__func__,PS_LOG_INFO,"Verify the returned psImage structure contains expected values in the "
@@ -322,13 +313,4 @@
     }
 
-    psLogMsg(__func__,PS_LOG_INFO,"Verify the returned psImage structure members nrow and ncol are equal to "
-             "the input parameter nrow and ncol respectively.");
-
-    if (subset3->numCols != c/2 || subset3->numRows != r/2) {
-        psError(__func__,"psImageSubset output size was not proper(%dx%d, should be %dx%d).",
-                subset3->numCols, subset3->numRows, c/2,r/2);
-        return 5;
-    }
-
     psLogMsg(__func__,PS_LOG_INFO,"Verify the returned psImage structure member type is equal to the input "
              "psImage structure member type.");
@@ -367,12 +349,4 @@
     }
 
-    psLogMsg(__func__,PS_LOG_INFO,"Verify the returned psImage structure member Nchildren is equal to "
-             "zero.");
-
-    if (subset2->nChildren != 0 || subset3->nChildren != 0) {
-        psError(__func__,"psImageSubset didn't set nChildren to zero.");
-        return 11;
-    }
-
     psLogMsg(__func__,PS_LOG_INFO,"Verify the returned psImage structure member children is null.");
 
@@ -386,9 +360,9 @@
              "out at parent[Nchildren-1].");
 
-    if (original->nChildren != preSubsetStruct.nChildren+2) {
-        psError(__func__,"psImageSubset didn't increment nChildren by one per subset.");
+    if (original->children == NULL || original->children->n != 2) {
+        psError(__func__,"psImageSubset didn't increment number of children by one per subset.");
         return 12;
     }
-    if (original->children[0] != subset2 || original->children[1] != subset3) {
+    if (original->children->data[0] != subset2 || original->children->data[1] != subset3) {
         psError(__func__,"psImageSubset didn't properly store the children pointers.");
         return 13;
@@ -400,5 +374,5 @@
 
     psLogMsg(__func__,PS_LOG_INFO,"An error should follow...");
-    subset1 = psImageSubset(NULL,c/2,r/2,0,0);
+    subset1 = psImageSubset(NULL,0,0,c/2,r/2);
     if (subset1 != NULL) {
         psError(__func__,"psImageSubset didn't return NULL when input image was NULL.");
@@ -412,5 +386,5 @@
     memcpy(&preSubsetStruct,original,sizeof(psImage));
     psLogMsg(__func__,PS_LOG_INFO,"An error should follow...");
-    subset1 = psImageSubset(original,c/2,0,0,0);
+    subset1 = psImageSubset(original,0,r/2,c/2,r/2);
     if (subset1 != NULL) {
         psError(__func__,"psImageSubset didn't return NULL when numRows=0.");
@@ -418,5 +392,5 @@
     }
     psLogMsg(__func__,PS_LOG_INFO,"An error should follow...");
-    subset1 = psImageSubset(original,0,r/2,0,0);
+    subset1 = psImageSubset(original,c/2,0,c/2,r/2);
     if (subset1 != NULL) {
         psError(__func__,"psImageSubset didn't return NULL when numCols=0.");
@@ -434,5 +408,5 @@
 
     psLogMsg(__func__,PS_LOG_INFO,"An error should follow...");
-    subset1 = psImageSubset(original,c/2,r/2,c,0);
+    subset1 = psImageSubset(original,0,0,c/2,r*2);
     if (subset1 != NULL) {
         psError(__func__,"psImageSubset didn't return NULL when subset origin was outside of "
@@ -441,5 +415,5 @@
     }
     psLogMsg(__func__,PS_LOG_INFO,"An error should follow...");
-    subset1 = psImageSubset(original,c/2,r/2,0,r);
+    subset1 = psImageSubset(original,0,0,c*2,r/2);
     if (subset1 != NULL) {
         psError(__func__,"psImageSubset didn't return NULL when subset origin was outside of "
@@ -448,5 +422,5 @@
     }
     psLogMsg(__func__,PS_LOG_INFO,"An error should follow...");
-    subset1 = psImageSubset(original,c/2,r/2,-1,0);
+    subset1 = psImageSubset(original,-1,0,c/2,r/2);
     if (subset1 != NULL) {
         psError(__func__,"psImageSubset didn't return NULL when subset origin was outside of "
@@ -455,5 +429,5 @@
     }
     psLogMsg(__func__,PS_LOG_INFO,"An error should follow...");
-    subset1 = psImageSubset(original,c/2,r/2,0,-1);
+    subset1 = psImageSubset(original,0,-1,c/2,r/2);
     if (subset1 != NULL) {
         psError(__func__,"psImageSubset didn't return NULL when subset origin was outside of "
@@ -468,5 +442,5 @@
 
     psLogMsg(__func__,PS_LOG_INFO,"An error should follow...");
-    subset1 = psImageSubset(original,c/2,r/2,c/2,0);
+    subset1 = psImageSubset(original,0,0,c/2,r+1);
     if (subset1 != NULL) {
         psError(__func__,"psImageSubset didn't return NULL when subset was outside of image (via rows).");
@@ -474,5 +448,5 @@
     }
     psLogMsg(__func__,PS_LOG_INFO,"An error should follow...");
-    subset1 = psImageSubset(original,c/2,r/2,0,r/2);
+    subset1 = psImageSubset(original,0,0,c+1,r/2);
     if (subset1 != NULL) {
         psError(__func__,"psImageSubset didn't return NULL when subset was outside of image (via cols).");
@@ -480,5 +454,5 @@
     }
     psLogMsg(__func__,PS_LOG_INFO,"An error should follow...");
-    subset1 = psImageSubset(original,c/2,r/2,c/2,r/2);
+    subset1 = psImageSubset(original,0,0,c+1,r+1);
     if (subset1 != NULL) {
         psError(__func__,"psImageSubset didn't return NULL when subset was outside of image (via row+cols).");
@@ -494,13 +468,7 @@
 
     // Verify the returned psImage structure member Nchildren is set to zero.
-    if (original->nChildren != 0) {
-        psError(__func__,"psImageFreeChildren didn't set nChildren to zero.");
+    if (original->children != NULL && original->children->n > 0) {
+        psError(__func__,"psImageFreeChildren didn't set number of children to zero.");
         return 25;
-    }
-
-    // Verify the returned psImage structure member children pointer is set to null.
-    if (original->children != NULL) {
-        psError(__func__,"psImageFreeChildren didn't set children ptr to NULL.");
-        return 26;
     }
 
