Index: trunk/psLib/test/dataManip/tst_psStats00.c
===================================================================
--- trunk/psLib/test/dataManip/tst_psStats00.c	(revision 887)
+++ trunk/psLib/test/dataManip/tst_psStats00.c	(revision 893)
@@ -11,4 +11,5 @@
 {
     psStats *myStats    = NULL;
+    psStats *myStats2    = NULL;
     int testStatus      = true;
     int globalTestStatus = true;
@@ -51,4 +52,6 @@
         }
     }
+
+
     realMeanNoMask /= (float) N;
     realMeanWithMask /= (float) count;
@@ -78,9 +81,9 @@
 
     /*************************************************************************/
-    /*  Call psVectorStats() with vector mask.                       */
-    /*************************************************************************/
-    printPositiveTestHeader(stdout,
-                            "psStats functions",
-                            "PS_STAT_SAMPLE_MEAN: with vector mask");
+    /*  Call psVectorStats() with vector mask=1.                             */
+    /*************************************************************************/
+    printPositiveTestHeader(stdout,
+                            "psStats functions",
+                            "PS_STAT_SAMPLE_MEAN: with vector mask=1");
 
     myStats = psVectorStats(myStats, myVector, maskVector, 1);
@@ -97,9 +100,85 @@
     printFooter(stdout,
                 "psVector functions",
-                "PS_STAT_SAMPLE_MEAN: with vector mask",
-                testStatus);
-
-    /*************************************************************************/
-    /*  Deallocate data structures                                   */
+                "PS_STAT_SAMPLE_MEAN: with vector mask=1",
+                testStatus);
+
+    /*************************************************************************/
+    /*  Call psVectorStats() with vector mask=2.                             */
+    /*************************************************************************/
+    printPositiveTestHeader(stdout,
+                            "psStats functions",
+                            "PS_STAT_SAMPLE_MEAN: with vector mask=2");
+
+    // Set the mask vector and calculate the expected maximum.
+    // Set the mask vector.
+    for (i=0;i<N;i++) {
+        if (maskVector->data.U8[i] == 1) {
+            maskVector->data.U8[i] = 2;
+        }
+    }
+
+    myStats = psVectorStats(myStats, myVector, maskVector, 2);
+    mean = myStats->sampleMean;
+    printf("Called psVectorStats() on a vector with last N/2 elements masked.\n");
+    printf("The expected mean was %f; the calculated mean was %f\n", realMeanWithMask, mean);
+    if (mean == realMeanWithMask) {
+        testStatus = true;
+    } else {
+        testStatus = false;
+        globalTestStatus = false;
+    }
+
+    printFooter(stdout,
+                "psVector functions",
+                "PS_STAT_SAMPLE_MEAN: with vector mask=2",
+                testStatus);
+
+    /*************************************************************************/
+    /*  Call psVectorStats() with vector mask=3.                             */
+    /*************************************************************************/
+    printPositiveTestHeader(stdout,
+                            "psStats functions",
+                            "PS_STAT_SAMPLE_MEAN: with vector mask=3");
+
+    // Set the mask vector and calculate the expected maximum.
+    // Set the mask vector.
+    for (i=0;i<N;i++) {
+        if (maskVector->data.U8[i] == 2) {
+            maskVector->data.U8[i] = 3;
+        }
+    }
+
+    myStats = psVectorStats(myStats, myVector, maskVector, 3);
+    mean = myStats->sampleMean;
+    printf("Called psVectorStats() on a vector with last N/2 elements masked.\n");
+    printf("The expected mean was %f; the calculated mean was %f\n", realMeanWithMask, mean);
+    if (mean == realMeanWithMask) {
+        testStatus = true;
+    } else {
+        testStatus = false;
+        globalTestStatus = false;
+    }
+
+    printFooter(stdout,
+                "psVector functions",
+                "PS_STAT_SAMPLE_MEAN: with vector mask=3",
+                testStatus);
+    /*************************************************************************/
+    /*  Call psVectorStats() with NULL inputs.                               */
+    /*************************************************************************/
+    printPositiveTestHeader(stdout,
+                            "psStats functions",
+                            "PS_STAT_SAMPLE_MEAN: NULL inputs");
+
+    myStats = psVectorStats(myStats, NULL, NULL, 0);
+    myStats2 = psVectorStats(NULL, myVector, NULL, 0);
+
+    printFooter(stdout,
+                "psVector functions",
+                "PS_STAT_SAMPLE_MEAN: NULL inputs",
+                testStatus);
+
+    /*************************************************************************/
+    /*  Deallocate data structures                                           */
     /*************************************************************************/
     printPositiveTestHeader(stdout,
