Index: trunk/psLib/test/dataManip/Makefile
===================================================================
--- trunk/psLib/test/dataManip/Makefile	(revision 677)
+++ trunk/psLib/test/dataManip/Makefile	(revision 678)
@@ -3,6 +3,6 @@
 ##  Makefile:   test/sysUtils
 ##
-##  $Revision: 1.2 $  $Name: not supported by cvs2svn $
-##  $Date: 2004-05-13 06:06:34 $
+##  $Revision: 1.3 $  $Name: not supported by cvs2svn $
+##  $Date: 2004-05-14 01:12:32 $
 ##
 ##  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -16,9 +16,13 @@
 PSLIB_LIB_DIR = ../../lib
 
-TARGET = tst_psStats00
+TARGET = tst_psStats00 \
+         tst_psStats01 \
+         tst_psStats02
 
 all: $(TARGET)
 
 tst_psStats00:		tst_psStats00.o
+tst_psStats01:		tst_psStats01.o
+tst_psStats02:		tst_psStats02.o
 
 clean:
Index: trunk/psLib/test/dataManip/tst_psStats00.c
===================================================================
--- trunk/psLib/test/dataManip/tst_psStats00.c	(revision 677)
+++ trunk/psLib/test/dataManip/tst_psStats00.c	(revision 678)
@@ -14,6 +14,4 @@
     int testStatus      = true;
     int i               = 0;
-    psType dummyFloatType;
-    psType dummyIntType;
     psVector *myVector  = NULL;
     psVector *maskVector= NULL;
@@ -25,14 +23,10 @@
     printPositiveTestHeader(stdout,
                             "psStats functions",
-                            "hmmm");
+                            "PS_STAT_SAMPLE_MEAN");
 
     myStats = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
-    dummyFloatType.type = PS_TYPE_FLOAT;
-    dummyFloatType.dimen = PS_DIMEN_VECTOR;
-    dummyIntType.type = PS_TYPE_INT;
-    dummyIntType.dimen = PS_DIMEN_VECTOR;
-    myVector = psVectorAlloc(dummyFloatType, N);
+    myVector = psVectorAlloc(PS_TYPE_FLOAT, N);
     myVector->n = N;
-    maskVector = psVectorAlloc(dummyIntType, N);
+    maskVector = psVectorAlloc(PS_TYPE_UINT8, N);
     maskVector->n = N;
 
@@ -42,10 +36,10 @@
         myVector->vec.f[i] = (float) i;
         if (i < (N/2)) {
-            maskVector->vec.i[i] = 0;
+            maskVector->vec.ui8[i] = 0;
             realMean2+= myVector->vec.f[i];
             count++;
         } else {
             printf("Masking element %d\n", i);
-            maskVector->vec.i[i] = 1;
+            maskVector->vec.ui8[i] = 1;
         }
         realMean1+= myVector->vec.f[i];
@@ -69,4 +63,9 @@
     printf("Called psArrayStats() on a vector with last N/2 elements masked.\n");
     printf("The expected mean was %f; the calculated mean was %f\n", realMean2, mean);
+    if (mean == realMean2) {
+        testStatus = true;
+    } else {
+        testStatus = false;
+    }
 
     printFooter(stdout,
Index: trunk/psLib/test/dataManip/tst_psStats01.c
===================================================================
--- trunk/psLib/test/dataManip/tst_psStats01.c	(revision 678)
+++ trunk/psLib/test/dataManip/tst_psStats01.c	(revision 678)
@@ -0,0 +1,75 @@
+/*****************************************************************************
+    This routine must ensure that PS_STAT_MAX is correctly computed
+    by the procedure psArrayStats().
+ *****************************************************************************/
+#include <stdio.h>
+#include "psLib.h"
+#include "psTest.h"
+#define N 10
+
+int main()
+{
+    psStats *myStats    = NULL;
+    psStats *myStats2   = NULL;
+    int testStatus      = true;
+    int i               = 0;
+    psVector *myVector  = NULL;
+    psVector *maskVector= NULL;
+    float max           = 0.0;
+    float realMax1      = 0.0;
+    float realMax2      = 0.0;
+
+    printPositiveTestHeader(stdout,
+                            "psStats functions",
+                            "PS_STAT_MAX");
+
+    myStats = psStatsAlloc(PS_STAT_MAX);
+    myVector = psVectorAlloc(PS_TYPE_FLOAT, N);
+    myVector->n = N;
+    maskVector = psVectorAlloc(PS_TYPE_UINT8, N);
+    maskVector->n = N;
+
+    for (i=0;i<N;i++) {
+        myVector->vec.f[i] = (float) i;
+        if (i < (N/2)) {
+            maskVector->vec.ui8[i] = 0;
+            if (myVector->vec.f[i] > realMax2) {
+                realMax2 = myVector->vec.f[i];
+            }
+        } else {
+            printf("Masking element %d\n", i);
+            maskVector->vec.ui8[i] = 1;
+            if (myVector->vec.f[i] > realMax1) {
+                realMax1 = myVector->vec.f[i];
+            }
+        }
+    }
+
+    myStats2 = psArrayStats(myVector, NULL, 0, myStats);
+    max = myStats2->max;
+
+    printf("Called psArrayStats() on a vector with no elements masked.\n");
+    printf("The expected max was %f; the calculated max was %f\n", realMax1, max);
+    if (max == realMax1) {
+        testStatus = true;
+    } else {
+        testStatus = false;
+    }
+
+    myStats2 = psArrayStats(myVector, maskVector, 1, myStats);
+    max = myStats2->max;
+    printf("Called psArrayStats() on a vector with last N/2 elements masked.\n");
+    printf("The expected max was %f; the calculated max was %f\n", realMax2, max);
+    if (max == realMax2) {
+        testStatus = true;
+    } else {
+        testStatus = false;
+    }
+
+    printFooter(stdout,
+                "psHash functions",
+                "psHashAlloc()",
+                testStatus);
+
+    return (!testStatus);
+}
Index: trunk/psLib/test/dataManip/tst_psStats02.c
===================================================================
--- trunk/psLib/test/dataManip/tst_psStats02.c	(revision 678)
+++ trunk/psLib/test/dataManip/tst_psStats02.c	(revision 678)
@@ -0,0 +1,75 @@
+/*****************************************************************************
+    This routine must ensure that PS_STAT_MIN is correctly computed
+    by the procedure psArrayStats().
+ *****************************************************************************/
+#include <stdio.h>
+#include "psLib.h"
+#include "psTest.h"
+#define N 10
+
+int main()
+{
+    psStats *myStats    = NULL;
+    psStats *myStats2   = NULL;
+    int testStatus      = true;
+    int i               = 0;
+    psVector *myVector  = NULL;
+    psVector *maskVector= NULL;
+    float min           = 1e99;
+    float realMin1      = 1e99;
+    float realMin2      = 1e99;
+
+    printPositiveTestHeader(stdout,
+                            "psStats functions",
+                            "PS_STAT_MIN");
+
+    myStats = psStatsAlloc(PS_STAT_MIN);
+    myVector = psVectorAlloc(PS_TYPE_FLOAT, N);
+    myVector->n = N;
+    maskVector = psVectorAlloc(PS_TYPE_UINT8, N);
+    maskVector->n = N;
+
+    for (i=0;i<N;i++) {
+        myVector->vec.f[i] = (float) i;
+        if (i < (N/2)) {
+            maskVector->vec.ui8[i] = 0;
+            if (myVector->vec.f[i] < realMin2) {
+                realMin2 = myVector->vec.f[i];
+            }
+        } else {
+            printf("Masking element %d\n", i);
+            maskVector->vec.ui8[i] = 1;
+            if (myVector->vec.f[i] < realMin1) {
+                realMin1 = myVector->vec.f[i];
+            }
+        }
+    }
+
+    myStats2 = psArrayStats(myVector, NULL, 0, myStats);
+    min = myStats2->min;
+
+    printf("Called psArrayStats() on a vector with no elements masked.\n");
+    printf("The expected min was %f; the calculated min was %f\n", realMin1, min);
+    if (min == realMin1) {
+        testStatus = true;
+    } else {
+        testStatus = false;
+    }
+
+    myStats2 = psArrayStats(myVector, maskVector, 1, myStats);
+    min = myStats2->min;
+    printf("Called psArrayStats() on a vector with last N/2 elements masked.\n");
+    printf("The expected min was %f; the calculated min was %f\n", realMin2, min);
+    if (min == realMin2) {
+        testStatus = true;
+    } else {
+        testStatus = false;
+    }
+
+    printFooter(stdout,
+                "psHash functions",
+                "psHashAlloc()",
+                testStatus);
+
+    return (!testStatus);
+}
