Index: trunk/psLib/test/image/tst_psImageStats00.c
===================================================================
--- trunk/psLib/test/image/tst_psImageStats00.c	(revision 887)
+++ trunk/psLib/test/image/tst_psImageStats00.c	(revision 904)
@@ -11,92 +11,162 @@
 #define NUM_BINS 20
 #define IMAGE_SIZE 20
+#define N 32
+#define M 64
 
 int main()
 {
     psHistogram *myHist = NULL;
+    psHistogram *myHist2= NULL;
     psImage *tmpImage   = NULL;
     psImage *tmpMask    = NULL;
     int testStatus      = true;
     int memLeaks        = 0;
+    int nb              = 0;
     int i               = 0;
     int j               = 0;
+    int IMAGE_X_SIZE    = 0;
+    int IMAGE_Y_SIZE    = 0;
     int currentId       = 0;
 
     currentId       = psMemGetId();
-    /*************************************************************************/
-    /*  Allocate and initialize data structures                      */
-    /*************************************************************************/
-    tmpImage = psImageAlloc(IMAGE_SIZE, IMAGE_SIZE, PS_TYPE_F32);
-    for (i=0;i<IMAGE_SIZE;i++) {
-        for (j=0;j<IMAGE_SIZE;j++) {
-            tmpImage->data.F32[i][j] = (float) (i + j);
+    for (nb=0;nb<6;nb++) {
+        if (nb == 0) {
+            IMAGE_X_SIZE = 1;
+            IMAGE_Y_SIZE = 1;
         }
-    }
-    tmpMask = psImageAlloc(IMAGE_SIZE, IMAGE_SIZE, PS_TYPE_U8);
-    for (i=0;i<IMAGE_SIZE;i++) {
-        for (j=0;j<IMAGE_SIZE;j++) {
-            if ((i > (IMAGE_SIZE/2)) &&
-                    (j > (IMAGE_SIZE/2))) {
-                tmpMask->data.U8[i][j] = 1;
-            } else {
-                tmpMask->data.U8[i][j] = 0;
+        if (nb == 1) {
+            IMAGE_X_SIZE = 1;
+            IMAGE_Y_SIZE = N;
+        }
+        if (nb == 2) {
+            IMAGE_X_SIZE = N;
+            IMAGE_Y_SIZE = 1;
+        }
+        if (nb == 3) {
+            IMAGE_X_SIZE = N;
+            IMAGE_Y_SIZE = N;
+        }
+        if (nb == 4) {
+            IMAGE_X_SIZE = N;
+            IMAGE_Y_SIZE = M;
+        }
+        if (nb == 5) {
+            IMAGE_X_SIZE = M;
+            IMAGE_Y_SIZE = N;
+        }
+        printf("*******************************\n");
+        printf("* IMAGE SIZE is (%d by %d)\n", IMAGE_X_SIZE, IMAGE_Y_SIZE);
+        printf("*******************************\n");
+        /*********************************************************************/
+        /*  Allocate and initialize data structures                      */
+        /*********************************************************************/
+        tmpImage = psImageAlloc(IMAGE_X_SIZE, IMAGE_Y_SIZE, PS_TYPE_F32);
+
+        for (i=0;i<tmpImage->numRows;i++) {
+            for (j=0;j<tmpImage->numCols;j++) {
+                tmpImage->data.F32[i][j] = (float) (i + j);
             }
         }
+        tmpMask = psImageAlloc(IMAGE_X_SIZE, IMAGE_Y_SIZE, PS_TYPE_U8);
+        for (i=0;i<tmpMask->numRows;i++) {
+            for (j=0;j<tmpMask->numCols;j++) {
+                if ((i > (tmpMask->numRows/2)) &&
+                        (j > (tmpMask->numCols/2))) {
+                    tmpMask->data.U8[i][j] = 1;
+                } else {
+                    tmpMask->data.U8[i][j] = 0;
+                }
+            }
+        }
+
+        /*************************************************************************/
+        /*  Calculate Histogram with no mask                             */
+        /*************************************************************************/
+        printPositiveTestHeader(stdout,
+                                "psImageStats functions",
+                                "Calculate Histogram, no mask");
+
+        myHist = psHistogramAlloc(0.0, (float) (IMAGE_X_SIZE + IMAGE_Y_SIZE),
+                                  NUM_BINS);
+        myHist = psImageHistogram(myHist, tmpImage, NULL, 0);
+        for (i=0;i<NUM_BINS;i++) {
+            printf("Bin number %d bounds: (%f - %f) data (%d)\n", i,
+                   myHist->bounds->data.F32[i],
+                   myHist->bounds->data.F32[i+1],
+                   myHist->nums->data.S32[i]);
+        }
+        psHistogramFree(myHist);
+
+        psMemCheckCorruption(1);
+        printFooter(stdout,
+                    "psImageStats functions",
+                    "Calculate Histogram, no mask",
+                    testStatus);
+
+        /*************************************************************************/
+        /*  Calculate Histogram with mask                                */
+        /*************************************************************************/
+        printPositiveTestHeader(stdout,
+                                "psImageStats functions",
+                                "Calculate Histogram with mask");
+
+        myHist = psHistogramAlloc(0.0, (float) (IMAGE_X_SIZE + IMAGE_Y_SIZE),
+                                  NUM_BINS);
+        myHist = psImageHistogram(myHist, tmpImage, tmpMask, 1);
+        for (i=0;i<NUM_BINS;i++) {
+            printf("Bin number %d bounds: (%f - %f) data (%d)\n", i,
+                   myHist->bounds->data.F32[i],
+                   myHist->bounds->data.F32[i+1],
+                   myHist->nums->data.S32[i]);
+        }
+
+        psMemCheckCorruption(1);
+        printFooter(stdout,
+                    "psImageStats functions",
+                    "Calculate Histogram with mask",
+                    testStatus);
+
+        /*************************************************************************/
+        /*  Deallocate data structures                                   */
+        /*************************************************************************/
+        printPositiveTestHeader(stdout,
+                                "psImageStats functions",
+                                "Deallocate the psHistogram/psImage structure.");
+        psHistogramFree(myHist);
+        psImageFree(tmpImage);
+        psImageFree(tmpMask);
+
+        psMemCheckCorruption(1);
+        memLeaks = psMemCheckLeaks(currentId,NULL,NULL);
+        if (0 != memLeaks) {
+            psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
+        }
+
+        printFooter(stdout,
+                    "psImageStats functions",
+                    "Deallocate the psHistogram/psImage structure.",
+                    testStatus);
     }
-    /*************************************************************************/
-    /*  Calculate Histogram with no mask                             */
-    /*************************************************************************/
     printPositiveTestHeader(stdout,
                             "psImageStats functions",
-                            "Calculate Histogram, no mask");
+                            "Calling psImageHistogram() with NULL parameters");
 
-    myHist = psHistogramAlloc(0.0, (float) (2 * IMAGE_SIZE), NUM_BINS);
-    myHist = psImageHistogram(myHist, tmpImage, NULL, 0);
-    for (i=0;i<NUM_BINS;i++) {
-        printf("Bin number %d bounds: (%f - %f) data (%d)\n", i,
-               myHist->bounds->data.F32[i],
-               myHist->bounds->data.F32[i+1],
-               myHist->nums->data.S32[i]);
+    tmpImage = psImageAlloc(IMAGE_X_SIZE, IMAGE_Y_SIZE, PS_TYPE_F32);
+    myHist  = psHistogramAlloc(0.0, (float) (IMAGE_X_SIZE + IMAGE_Y_SIZE),
+                               NUM_BINS);
+    myHist2 = psImageHistogram(NULL, tmpImage, NULL, 0);
+    if (myHist2 != NULL) {
+        printf("ERROR: myHist2 not equal to NULL\n");
     }
-    psHistogramFree(myHist);
 
-    psMemCheckCorruption(1);
-    printFooter(stdout,
-                "psImageStats functions",
-                "Calculate Histogram, no mask",
-                testStatus);
-
-    /*************************************************************************/
-    /*  Calculate Histogram with mask                                */
-    /*************************************************************************/
-    printPositiveTestHeader(stdout,
-                            "psImageStats functions",
-                            "Calculate Histogram with mask");
-
-    myHist = psHistogramAlloc(0.0, (float) (2 * IMAGE_SIZE), NUM_BINS);
-    myHist = psImageHistogram(myHist, tmpImage, tmpMask, 1);
-    for (i=0;i<NUM_BINS;i++) {
-        printf("Bin number %d bounds: (%f - %f) data (%d)\n", i,
-               myHist->bounds->data.F32[i],
-               myHist->bounds->data.F32[i+1],
-               myHist->nums->data.S32[i]);
+    myHist2 = psImageHistogram(myHist, NULL, NULL, 0);
+    myHist2 = psImageHistogram(NULL, tmpImage, NULL, 0);
+    if (myHist2 != NULL) {
+        printf("ERROR: myHist2 not equal to NULL\n");
     }
 
     psMemCheckCorruption(1);
-    printFooter(stdout,
-                "psImageStats functions",
-                "Calculate Histogram with mask",
-                testStatus);
-
-    /*************************************************************************/
-    /*  Deallocate data structures                                   */
-    /*************************************************************************/
-    printPositiveTestHeader(stdout,
-                            "psImageStats functions",
-                            "Deallocate the psHistogram/psImage structure.");
     psHistogramFree(myHist);
     psImageFree(tmpImage);
-    psImageFree(tmpMask);
-
     psMemCheckCorruption(1);
     memLeaks = psMemCheckLeaks(currentId,NULL,NULL);
@@ -107,5 +177,5 @@
     printFooter(stdout,
                 "psImageStats functions",
-                "Deallocate the psHistogram/psImage structure.",
+                "Calling psImageHistogram() with NULL parameters",
                 testStatus);
 
