Index: trunk/psLib/test/dataManip/tst_psHist00.c
===================================================================
--- trunk/psLib/test/dataManip/tst_psHist00.c	(revision 887)
+++ trunk/psLib/test/dataManip/tst_psHist00.c	(revision 893)
@@ -7,9 +7,6 @@
 #include "psTest.h"
 #include "psMemory.h"
-#define MISC_FLOAT_NUMBER 345.0
-#define MISC_INT_NUMBER 345
 #define LOWER 20.0
 #define UPPER 30.0
-#define NUM_BINS 200
 
 int main()
@@ -19,32 +16,88 @@
     int memLeaks        = 0;
     int i               = 0;
+    int nb              = 0;
+    int numBins         = 0;
     int currentId       = 0;
 
     currentId       = psMemGetId();
-    /*************************************************************************/
-    /*  Allocate and initialize data structures                      */
-    /*************************************************************************/
+    for (nb=0;nb<4;nb++) {
+        if (nb == 0)
+            numBins = 1;
+        if (nb == 1)
+            numBins = 2;
+        if (nb == 2)
+            numBins = 10;
+        if (nb == 3)
+            numBins = 20;
+        /*********************************************************************/
+        /*  Allocate and initialize data structures                          */
+        /*********************************************************************/
+        printPositiveTestHeader(stdout,
+                                "psStats functions",
+                                "Allocate the psHistogram structure.");
+
+        myHist = psHistogramAlloc(LOWER, UPPER, numBins);
+
+        if (myHist->nums->n != numBins) {
+            printf("ERROR: myHist->nums->n is wrong size (%d)\n", myHist->nums->n);
+            testStatus = false;
+        }
+
+        if (myHist->bounds->n != numBins+1) {
+            printf("ERROR: myHist->bounds->n is wrong size (%d)\n", myHist->bounds->n);
+            testStatus = false;
+        }
+
+        for (i=0;i<numBins;i++) {
+            if (myHist->nums->data.S32[i] != 0) {
+                printf("ERROR: myHist->nums->data.S32[%d] not initialized to 0.\n", i);
+                testStatus = false;
+            }
+            myHist->nums->data.S32[i] = 0;
+        }
+
+        if (myHist->minNum != 0) {
+            printf("ERROR: myHist->minNum is %d\n", myHist->minNum);
+            testStatus = false;
+        }
+
+        if (myHist->maxNum != 0) {
+            printf("myHist->maxNum is %d\n", myHist->maxNum);
+            testStatus = false;
+        }
+
+        if (myHist->uniform != 1) {
+            printf("ERROR: myHist->uniform is %d\n", myHist->uniform);
+            testStatus = false;
+        }
+
+        for (i=0;i<numBins;i++) {
+            printf("Bin number %d bounds: (%f - %f)\n", i,
+                   myHist->bounds->data.F32[i],
+                   myHist->bounds->data.F32[i+1]);
+        }
+
+        psMemCheckCorruption(1);
+        psHistogramFree(myHist);
+        psMemCheckCorruption(1);
+
+        printFooter(stdout,
+                    "psStats functions",
+                    "Allocate the psHistogram structure.",
+                    testStatus);
+    }
+
+
     printPositiveTestHeader(stdout,
                             "psStats functions",
-                            "Allocate the psHistogram structure.");
+                            "Allocate the psHistogram structure. (UPPER<LOWER)");
 
-    myHist = psHistogramAlloc(LOWER, UPPER, NUM_BINS);
-    for (i=0;i<NUM_BINS;i++) {
-        myHist->nums->data.S32[i] = MISC_INT_NUMBER;
+    myHist = psHistogramAlloc(UPPER, LOWER, numBins);
+    if (myHist != NULL) {
+        printf("ERROR: myHist != NULL\n");
     }
-    for (i=0;i<NUM_BINS;i++) {
-        printf("Bin number %d bounds: (%f - %f)\n", i,
-               myHist->bounds->data.F32[i],
-               myHist->bounds->data.F32[i+1]);
-    }
-    printf("myHist->minNum is %d\n", myHist->minNum);
-    printf("myHist->maxNum is %d\n", myHist->maxNum);
-    printf("myHist->uniform is %d\n", myHist->uniform);
-
-    psMemCheckCorruption(1);
-
     printFooter(stdout,
                 "psStats functions",
-                "Allocate the psHistogram structure.",
+                "Allocate the psHistogram structure. (UPPER<LOWER)",
                 testStatus);
 
@@ -55,5 +108,4 @@
                             "psStats functions",
                             "Deallocate the psHistogram structure.");
-    psHistogramFree(myHist);
 
     psMemCheckCorruption(1);
