Index: trunk/psLib/test/dataManip/tst_psHist01.c
===================================================================
--- trunk/psLib/test/dataManip/tst_psHist01.c	(revision 887)
+++ trunk/psLib/test/dataManip/tst_psHist01.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()
@@ -20,50 +17,86 @@
     int memLeaks        = 0;
     int i               = 0;
+    int nb              = 0;
+    int numBins         = 0;
     int currentId       = 0;
 
     currentId       = psMemGetId();
+    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.");
+        myBounds = psVectorAlloc(numBins+1, PS_TYPE_F32);
+        myBounds->n = myBounds->nalloc;
+        for (i=0;i<numBins+1;i++) {
+            myBounds->data.F32[i] = LOWER + ((UPPER - LOWER) / (float) numBins) *
+                                    (float) i;
+        }
+        myHist = psHistogramAllocGeneric(myBounds);
+
+        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 != 0) {
+            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);
+        psVectorFree(myBounds);
+
+        printFooter(stdout,
+                    "psStats functions",
+                    "Allocate the psHistogram structure.",
+                    testStatus);
+    }
     /*************************************************************************/
-    /*  Allocate and initialize data structures                      */
-    /*************************************************************************/
-    printPositiveTestHeader(stdout,
-                            "psStats functions",
-                            "Allocate the psHistogram structure.");
-    myBounds = psVectorAlloc(NUM_BINS+1, PS_TYPE_F32);
-    myBounds->n = myBounds->nalloc;
-    for (i=0;i<NUM_BINS+1;i++) {
-        myBounds->data.F32[i] = LOWER + ((UPPER - LOWER) / (float) NUM_BINS) *
-                                (float) i;
-    }
-    myHist = psHistogramAllocGeneric(myBounds);
-
-    for (i=0;i<NUM_BINS;i++) {
-        myHist->nums->data.S32[i] = MISC_INT_NUMBER;
-    }
-
-    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.",
-                testStatus);
-
-    /*************************************************************************/
-    /*  Deallocate data structures                                   */
+    /*  Deallocate data structures                                           */
     /*************************************************************************/
     printPositiveTestHeader(stdout,
                             "psStats functions",
                             "Deallocate the psHistogram structure.");
-    psHistogramFree(myHist);
-    psVectorFree(myBounds);
-
     psMemCheckCorruption(1);
     memLeaks = psMemCheckLeaks(currentId,NULL,NULL);
