Index: /trunk/psLib/test/image/tst_psImageStats01.c
===================================================================
--- /trunk/psLib/test/image/tst_psImageStats01.c	(revision 893)
+++ /trunk/psLib/test/image/tst_psImageStats01.c	(revision 894)
@@ -12,80 +12,157 @@
 #include "psImageStats.h"
 #define NUM_BINS 20
-#define IMAGE_SIZE 512
+#define N 32
+#define M 64
 
 int main()
 {
     psStats *myStats    = NULL;
+    psStats *myStats2   = 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;
+                }
+            }
+        }
+
+        myStats = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
+        /*************************************************************************/
+        /*  Calculate Sample Mean with no mask                           */
+        /*************************************************************************/
+        printPositiveTestHeader(stdout,
+                                "psImageStats functions",
+                                "Calculate Sample Mean, no mask %d");
+
+        myStats = psImageStats(myStats, tmpImage, NULL, 0);
+        printf("The sample mean was %f\n", myStats->sampleMean);
+
+        psMemCheckCorruption(1);
+
+        printFooter(stdout,
+                    "psImageStats functions",
+                    "Calculate Sample Mean, no mask",
+                    testStatus);
+
+        /*************************************************************************/
+        /*  Calculate Sample Mean with mask                              */
+        /*************************************************************************/
+        printPositiveTestHeader(stdout,
+                                "psImageStats functions",
+                                "Calculate Sample Mean with mask");
+
+        myStats = psImageStats(myStats, tmpImage, tmpMask, 1);
+        printf("The sample mean was %f\n", myStats->sampleMean);
+
+        psMemCheckCorruption(1);
+
+        printFooter(stdout,
+                    "psImageStats functions",
+                    "Calculate Sample Mean with mask",
+                    testStatus);
+
+        /*************************************************************************/
+        /*  Deallocate data structures                                   */
+        /*************************************************************************/
+        printPositiveTestHeader(stdout,
+                                "psImageStats functions",
+                                "Deallocate the psStats/psImage structure.");
+        psStatsFree(myStats);
+        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 psStats/psImage structure.",
+                    testStatus);
     }
 
-    myStats = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
     /*************************************************************************/
-    /*  Calculate Sample Mean with no mask                           */
+    /*  Test With Various Null Inputs                                        */
     /*************************************************************************/
     printPositiveTestHeader(stdout,
                             "psImageStats functions",
-                            "Calculate Sample Mean, no mask");
+                            "Test With Various Null Inputs");
+
+    tmpImage = psImageAlloc(IMAGE_X_SIZE, IMAGE_Y_SIZE, PS_TYPE_F32);
+    tmpMask = psImageAlloc(IMAGE_X_SIZE, IMAGE_Y_SIZE, PS_TYPE_U8);
+    myStats = psStatsAlloc(0);
+
+    myStats2 = psImageStats(myStats, NULL, NULL, 0);
+    if (myStats2 != NULL) {
+        printf("ERROR: myStats2 = psImageStats(myStats, NULL, NULL, 0) != NULL\n");
+    }
+
+    myStats2 = psImageStats(NULL, tmpImage, NULL, 0);
+    if (myStats2 != NULL) {
+        printf("ERROR: myStats2 = psImageStats(NULL, tmpImage, NULL, 0) != NULL\n");
+    }
 
     myStats = psImageStats(myStats, tmpImage, NULL, 0);
-    printf("The sample mean was %f\n", myStats->sampleMean);
+    //
+    // NOTE: verify that myStats is good here.
+    //
 
-    psMemCheckCorruption(1);
-
-    printFooter(stdout,
-                "psImageStats functions",
-                "Calculate Sample Mean, no mask",
-                testStatus);
-
-    /*************************************************************************/
-    /*  Calculate Sample Mean with mask                              */
-    /*************************************************************************/
-    printPositiveTestHeader(stdout,
-                            "psImageStats functions",
-                            "Calculate Sample Mean with mask");
-
-    myStats = psImageStats(myStats, tmpImage, tmpMask, 1);
-    printf("The sample mean was %f\n", myStats->sampleMean);
-
-    psMemCheckCorruption(1);
-
-    printFooter(stdout,
-                "psImageStats functions",
-                "Calculate Sample Mean with mask",
-                testStatus);
-
-    /*************************************************************************/
-    /*  Deallocate data structures                                   */
-    /*************************************************************************/
-    printPositiveTestHeader(stdout,
-                            "psImageStats functions",
-                            "Deallocate the psStats/psImage structure.");
     psStatsFree(myStats);
     psImageFree(tmpImage);
@@ -100,7 +177,6 @@
     printFooter(stdout,
                 "psImageStats functions",
-                "Deallocate the psStats/psImage structure.",
+                "Test With Various Null Inputs",
                 testStatus);
-
     return (!testStatus);
 }
Index: /trunk/psLib/test/image/verified/tst_psImageStats01.stdout
===================================================================
--- /trunk/psLib/test/image/verified/tst_psImageStats01.stdout	(revision 893)
+++ /trunk/psLib/test/image/verified/tst_psImageStats01.stdout	(revision 894)
@@ -1,29 +1,201 @@
-/----------------------------- TESTPOINT ------------------------------------------\
-|             TestFile: tst_psImageStats01.c                                       |
-|            TestPoint: psImageStats functions{Calculate Sample Mean, no mask}     |
-|             TestType: Positive                                                   |
-\----------------------------------------------------------------------------------/
-
-The sample mean was 510.608276
-
----> TESTPOINT PASSED (psImageStats functions{Calculate Sample Mean, no mask} | tst_psImageStats01.c)
-
-/----------------------------- TESTPOINT ------------------------------------------\
-|             TestFile: tst_psImageStats01.c                                       |
-|            TestPoint: psImageStats functions{Calculate Sample Mean with mask}    |
-|             TestType: Positive                                                   |
-\----------------------------------------------------------------------------------/
-
-The sample mean was 425.861176
-
----> TESTPOINT PASSED (psImageStats functions{Calculate Sample Mean with mask} | tst_psImageStats01.c)
-
-/----------------------------- TESTPOINT ------------------------------------------\
-|             TestFile: tst_psImageStats01.c                                       |
-|            TestPoint: psImageStats functions{Deallocate the psStats/psImage structure.} |
-|             TestType: Positive                                                   |
-\----------------------------------------------------------------------------------/
-
-
----> TESTPOINT PASSED (psImageStats functions{Deallocate the psStats/psImage structure.} | tst_psImageStats01.c)
-
+*******************************
+* IMAGE SIZE is (1 by 1)
+*******************************
+/----------------------------- TESTPOINT ------------------------------------------\
+|             TestFile: tst_psImageStats01.c                                       |
+|            TestPoint: psImageStats functions{Calculate Sample Mean, no mask %d}  |
+|             TestType: Positive                                                   |
+\----------------------------------------------------------------------------------/
+
+The sample mean was 0.000000
+
+---> TESTPOINT PASSED (psImageStats functions{Calculate Sample Mean, no mask} | tst_psImageStats01.c)
+
+/----------------------------- TESTPOINT ------------------------------------------\
+|             TestFile: tst_psImageStats01.c                                       |
+|            TestPoint: psImageStats functions{Calculate Sample Mean with mask}    |
+|             TestType: Positive                                                   |
+\----------------------------------------------------------------------------------/
+
+The sample mean was 0.000000
+
+---> TESTPOINT PASSED (psImageStats functions{Calculate Sample Mean with mask} | tst_psImageStats01.c)
+
+/----------------------------- TESTPOINT ------------------------------------------\
+|             TestFile: tst_psImageStats01.c                                       |
+|            TestPoint: psImageStats functions{Deallocate the psStats/psImage structure.} |
+|             TestType: Positive                                                   |
+\----------------------------------------------------------------------------------/
+
+
+---> TESTPOINT PASSED (psImageStats functions{Deallocate the psStats/psImage structure.} | tst_psImageStats01.c)
+
+*******************************
+* IMAGE SIZE is (1 by 32)
+*******************************
+/----------------------------- TESTPOINT ------------------------------------------\
+|             TestFile: tst_psImageStats01.c                                       |
+|            TestPoint: psImageStats functions{Calculate Sample Mean, no mask %d}  |
+|             TestType: Positive                                                   |
+\----------------------------------------------------------------------------------/
+
+The sample mean was 15.500000
+
+---> TESTPOINT PASSED (psImageStats functions{Calculate Sample Mean, no mask} | tst_psImageStats01.c)
+
+/----------------------------- TESTPOINT ------------------------------------------\
+|             TestFile: tst_psImageStats01.c                                       |
+|            TestPoint: psImageStats functions{Calculate Sample Mean with mask}    |
+|             TestType: Positive                                                   |
+\----------------------------------------------------------------------------------/
+
+The sample mean was 15.500000
+
+---> TESTPOINT PASSED (psImageStats functions{Calculate Sample Mean with mask} | tst_psImageStats01.c)
+
+/----------------------------- TESTPOINT ------------------------------------------\
+|             TestFile: tst_psImageStats01.c                                       |
+|            TestPoint: psImageStats functions{Deallocate the psStats/psImage structure.} |
+|             TestType: Positive                                                   |
+\----------------------------------------------------------------------------------/
+
+
+---> TESTPOINT PASSED (psImageStats functions{Deallocate the psStats/psImage structure.} | tst_psImageStats01.c)
+
+*******************************
+* IMAGE SIZE is (32 by 1)
+*******************************
+/----------------------------- TESTPOINT ------------------------------------------\
+|             TestFile: tst_psImageStats01.c                                       |
+|            TestPoint: psImageStats functions{Calculate Sample Mean, no mask %d}  |
+|             TestType: Positive                                                   |
+\----------------------------------------------------------------------------------/
+
+The sample mean was 15.500000
+
+---> TESTPOINT PASSED (psImageStats functions{Calculate Sample Mean, no mask} | tst_psImageStats01.c)
+
+/----------------------------- TESTPOINT ------------------------------------------\
+|             TestFile: tst_psImageStats01.c                                       |
+|            TestPoint: psImageStats functions{Calculate Sample Mean with mask}    |
+|             TestType: Positive                                                   |
+\----------------------------------------------------------------------------------/
+
+The sample mean was 15.500000
+
+---> TESTPOINT PASSED (psImageStats functions{Calculate Sample Mean with mask} | tst_psImageStats01.c)
+
+/----------------------------- TESTPOINT ------------------------------------------\
+|             TestFile: tst_psImageStats01.c                                       |
+|            TestPoint: psImageStats functions{Deallocate the psStats/psImage structure.} |
+|             TestType: Positive                                                   |
+\----------------------------------------------------------------------------------/
+
+
+---> TESTPOINT PASSED (psImageStats functions{Deallocate the psStats/psImage structure.} | tst_psImageStats01.c)
+
+*******************************
+* IMAGE SIZE is (32 by 32)
+*******************************
+/----------------------------- TESTPOINT ------------------------------------------\
+|             TestFile: tst_psImageStats01.c                                       |
+|            TestPoint: psImageStats functions{Calculate Sample Mean, no mask %d}  |
+|             TestType: Positive                                                   |
+\----------------------------------------------------------------------------------/
+
+The sample mean was 31.000000
+
+---> TESTPOINT PASSED (psImageStats functions{Calculate Sample Mean, no mask} | tst_psImageStats01.c)
+
+/----------------------------- TESTPOINT ------------------------------------------\
+|             TestFile: tst_psImageStats01.c                                       |
+|            TestPoint: psImageStats functions{Calculate Sample Mean with mask}    |
+|             TestType: Positive                                                   |
+\----------------------------------------------------------------------------------/
+
+The sample mean was 26.212767
+
+---> TESTPOINT PASSED (psImageStats functions{Calculate Sample Mean with mask} | tst_psImageStats01.c)
+
+/----------------------------- TESTPOINT ------------------------------------------\
+|             TestFile: tst_psImageStats01.c                                       |
+|            TestPoint: psImageStats functions{Deallocate the psStats/psImage structure.} |
+|             TestType: Positive                                                   |
+\----------------------------------------------------------------------------------/
+
+
+---> TESTPOINT PASSED (psImageStats functions{Deallocate the psStats/psImage structure.} | tst_psImageStats01.c)
+
+*******************************
+* IMAGE SIZE is (32 by 64)
+*******************************
+/----------------------------- TESTPOINT ------------------------------------------\
+|             TestFile: tst_psImageStats01.c                                       |
+|            TestPoint: psImageStats functions{Calculate Sample Mean, no mask %d}  |
+|             TestType: Positive                                                   |
+\----------------------------------------------------------------------------------/
+
+The sample mean was 47.000000
+
+---> TESTPOINT PASSED (psImageStats functions{Calculate Sample Mean, no mask} | tst_psImageStats01.c)
+
+/----------------------------- TESTPOINT ------------------------------------------\
+|             TestFile: tst_psImageStats01.c                                       |
+|            TestPoint: psImageStats functions{Calculate Sample Mean with mask}    |
+|             TestType: Positive                                                   |
+\----------------------------------------------------------------------------------/
+
+The sample mean was 39.656349
+
+---> TESTPOINT PASSED (psImageStats functions{Calculate Sample Mean with mask} | tst_psImageStats01.c)
+
+/----------------------------- TESTPOINT ------------------------------------------\
+|             TestFile: tst_psImageStats01.c                                       |
+|            TestPoint: psImageStats functions{Deallocate the psStats/psImage structure.} |
+|             TestType: Positive                                                   |
+\----------------------------------------------------------------------------------/
+
+
+---> TESTPOINT PASSED (psImageStats functions{Deallocate the psStats/psImage structure.} | tst_psImageStats01.c)
+
+*******************************
+* IMAGE SIZE is (64 by 32)
+*******************************
+/----------------------------- TESTPOINT ------------------------------------------\
+|             TestFile: tst_psImageStats01.c                                       |
+|            TestPoint: psImageStats functions{Calculate Sample Mean, no mask %d}  |
+|             TestType: Positive                                                   |
+\----------------------------------------------------------------------------------/
+
+The sample mean was 47.000000
+
+---> TESTPOINT PASSED (psImageStats functions{Calculate Sample Mean, no mask} | tst_psImageStats01.c)
+
+/----------------------------- TESTPOINT ------------------------------------------\
+|             TestFile: tst_psImageStats01.c                                       |
+|            TestPoint: psImageStats functions{Calculate Sample Mean with mask}    |
+|             TestType: Positive                                                   |
+\----------------------------------------------------------------------------------/
+
+The sample mean was 39.656349
+
+---> TESTPOINT PASSED (psImageStats functions{Calculate Sample Mean with mask} | tst_psImageStats01.c)
+
+/----------------------------- TESTPOINT ------------------------------------------\
+|             TestFile: tst_psImageStats01.c                                       |
+|            TestPoint: psImageStats functions{Deallocate the psStats/psImage structure.} |
+|             TestType: Positive                                                   |
+\----------------------------------------------------------------------------------/
+
+
+---> TESTPOINT PASSED (psImageStats functions{Deallocate the psStats/psImage structure.} | tst_psImageStats01.c)
+
+/----------------------------- TESTPOINT ------------------------------------------\
+|             TestFile: tst_psImageStats01.c                                       |
+|            TestPoint: psImageStats functions{Test With Various Null Inputs}      |
+|             TestType: Positive                                                   |
+\----------------------------------------------------------------------------------/
+
+
+---> TESTPOINT PASSED (psImageStats functions{Test With Various Null Inputs} | tst_psImageStats01.c)
+
