Index: trunk/psModules/src/tst_pmMaskBadPixels.c
===================================================================
--- trunk/psModules/src/tst_pmMaskBadPixels.c	(revision 1870)
+++ trunk/psModules/src/tst_pmMaskBadPixels.c	(revision 1874)
@@ -3,8 +3,20 @@
  *  @brief Contains the tests for pmMaskBadPixels:
  *
+ *    Test A - Create mask based on maskVal argument
+ *    Test B - Create mask based on saturation argument
+ *    Test C - Create mask based on growVal and grow arguments
+ *    Test D - Auto Create mask based on maskVal argument
+ *    Test E - Attempt to use null mask
+ *    Test F - Attempt tp use null input image
+ *    Test G - Attempt to use input image bigger than mask
+ *    Test H - Attempt to use input image mask bigger than mask
+ *    Test I - Attempt to use offset greater than input image
+ *    Test J - Attempt to use complex input image
+ *    Test K - Attempt to use non-mask type mask image
+ *
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-09-23 23:33:54 $
+ *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-09-24 01:34:43 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -67,5 +79,5 @@
     CREATE_AND_SET_IMAGE(inImage1,F64,0,50,50);
     CREATE_AND_SET_IMAGE(mask1,U8,0,50,50)
-    psReadout *inReadout  = psReadoutAlloc(0, 0, inImage1);
+    psReadout *inReadout = psReadoutAlloc(0, 0, inImage1);
     mask1->data.PS_TYPE_MASK_DATA[24][24]=1;
     PRINT_MATRIX(mask1, U8, "Data mask:");
@@ -83,5 +95,5 @@
     CREATE_AND_SET_IMAGE(inImage2,F64,150.0,50,50);
     CREATE_AND_SET_IMAGE(mask2,U8,0,50,50)
-    psReadout *inReadout2  = psReadoutAlloc(0, 0, inImage2);
+    psReadout *inReadout2 = psReadoutAlloc(0, 0, inImage2);
     PRINT_MATRIX(mask2, U8, "Data mask:");
     pmMaskBadPixels(inReadout2, mask2, 0, 100.0, 0, 0);
@@ -98,6 +110,8 @@
     CREATE_AND_SET_IMAGE(inImage3,F64,50.0,50,50);
     CREATE_AND_SET_IMAGE(mask3,U8,0,50,50)
-    psReadout *inReadout3  = psReadoutAlloc(0, 0, inImage3);
+    psReadout *inReadout3 = psReadoutAlloc(0, 0, inImage3);
     mask3->data.PS_TYPE_MASK_DATA[24][24]=1;
+    mask3->data.PS_TYPE_MASK_DATA[4][3]=1;
+    mask3->data.PS_TYPE_MASK_DATA[4][46]=1;
     PRINT_MATRIX(mask3, U8, "Data mask:");
     pmMaskBadPixels(inReadout3, mask3, 0, 100.0, 1, 10);
@@ -110,10 +124,10 @@
 
 
-    // Test D - Create mask based on maskVal argument starting with non-null mask
-    printPositiveTestHeader(stdout, "pmMaskBadPixels", "Test D - Create mask based on maskVal argument starting with non-null mask");
+    // Test D - Auto Create mask based on maskVal argument
+    printPositiveTestHeader(stdout, "pmMaskBadPixels", "Test D - Auto create mask based on maskVal argument");
     CREATE_AND_SET_IMAGE(inImage4,F64,50.0,50,50);
     CREATE_AND_SET_IMAGE(mask4,U8,0,50,50)
     CREATE_AND_SET_IMAGE(mask4i,U8,0,50,50)
-    psReadout *inReadout4  = psReadoutAlloc(0, 0, inImage4);
+    psReadout *inReadout4 = psReadoutAlloc(0, 0, inImage4);
     inReadout4->mask = mask4i;
     mask4->data.PS_TYPE_MASK_DATA[24][24]=1;
@@ -124,7 +138,113 @@
     psFree(inReadout4);
     psFree(inImage4);
-    printFooter(stdout, "pmMaskBadPixels", "Test D - Create mask based on maskVal argument starting with non-null mask", true);
-    printf("\n\n\n");
-
+    printFooter(stdout, "pmMaskBadPixels", "Test D - Auto create mask based on maskVal argument", true);
+    printf("\n\n\n");
+
+
+    // Test E - Attempt to use null mask
+    printNegativeTestHeader(stdout,"pmMaskBadPixels", "Test E - Attempt to use null mask",
+                            "Null not allowed for mask image", 0);
+    CREATE_AND_SET_IMAGE(inImage5,F64,50.0,50,50);
+    psReadout *inReadout5 = psReadoutAlloc(0, 0, inImage5);
+    pmMaskBadPixels(inReadout4, NULL, 0, 100.0, 1, 10);
+    psFree(inReadout5);
+    psFree(inImage5);
+    printFooter(stdout, "pmMaskBadPixels", "Test E - Attempt to use null mask", true);
+    printf("\n\n\n");
+
+
+    // Test F - Attempt tp use null input image
+    printNegativeTestHeader(stdout,"pmMaskBadPixels", "Test F - Attempt tp use null input image",
+                            "Null not allowed for input image", 0);
+
+    CREATE_AND_SET_IMAGE(mask6,U8,0,50,50)
+    psReadout *inReadout6 = psReadoutAlloc(0, 0, NULL);
+    inReadout6->mask = mask6;
+    pmMaskBadPixels(inReadout6, mask6, 0, 100.0, 1, 10);
+    psFree(inReadout6);
+    printFooter(stdout, "pmMaskBadPixels", "Test F - Attempt tp use null input image", true);
+    printf("\n\n\n");
+
+
+    // Test G - Attempt to use input image bigger than mask
+    printNegativeTestHeader(stdout,"pmMaskBadPixels", "Test G - Attempt to use input image bigger than mask",
+                            "Input image size exceeds that of mask image", 0);
+    CREATE_AND_SET_IMAGE(inImage7,F64,0.0,60,60);
+    CREATE_AND_SET_IMAGE(mask7,U8,0,50,50)
+    CREATE_AND_SET_IMAGE(mask7i,U8,0,50,50)
+    psReadout *inReadout7 = psReadoutAlloc(0, 0, inImage7);
+    inReadout4->mask = mask7i;
+    pmMaskBadPixels(inReadout4, mask7, 0, 100.0, 1, 10);
+    psFree(mask7);
+    psFree(inReadout7);
+    psFree(inImage7);
+    printFooter(stdout, "pmMaskBadPixels", "Test G - Attempt to use input image bigger than mask", true);
+    printf("\n\n\n");
+
+
+    // Test H - Attempt to use input image mask bigger than mask
+    printNegativeTestHeader(stdout,"pmMaskBadPixels", "Test H - Attempt to use input image mask bigger than mask",
+                            "Input image mask size exceeds that of mask image", 0);
+    CREATE_AND_SET_IMAGE(inImage8,F64,0.0,50,50);
+    CREATE_AND_SET_IMAGE(mask8,U8,0,50,50)
+    CREATE_AND_SET_IMAGE(mask8i,U8,0,60,60)
+    psReadout *inReadout8 = psReadoutAlloc(0, 0, inImage8);
+    inReadout8->mask = mask8i;
+    pmMaskBadPixels(inReadout8, mask8, 0, 100.0, 1, 10);
+    psFree(mask8);
+    psFree(inReadout8);
+    psFree(inImage8);
+    printFooter(stdout, "pmMaskBadPixels", "Test H - Attempt to use input image mask bigger than mask", true);
+    printf("\n\n\n");
+
+
+    // Test I - Attempt to use offset greater than input image
+    printNegativeTestHeader(stdout,"pmMaskBadPixels", "Test I - Attempt to use offset greater than input image",
+                            "Total offset >= input image size", 0);
+    CREATE_AND_SET_IMAGE(inImage9,F64,0.0,50,50);
+    CREATE_AND_SET_IMAGE(mask9,U8,0,50,50)
+    CREATE_AND_SET_IMAGE(mask9i,U8,0,50,50)
+    psReadout *inReadout9 = psReadoutAlloc(0, 0, inImage9);
+    inReadout9->mask = mask9i;
+    *(int*)&inReadout->col0 = 150;
+    *(int*)&inReadout->row0 = 150;
+    pmMaskBadPixels(inReadout9, mask9, 0, 100.0, 1, 10);
+    psFree(mask9);
+    psFree(inReadout9);
+    psFree(inImage9);
+    printFooter(stdout, "pmMaskBadPixels", "Test I - Attempt to use offset greater than input image", true);
+    printf("\n\n\n");
+
+
+    // Test J - Attempt to use complex input image
+    printNegativeTestHeader(stdout,"pmMaskBadPixels", "Test J - Attempt to use complex input image",
+                            "Complex types not allowed for input image", 0);
+    CREATE_AND_SET_IMAGE(inImage10,C64,50.0,50,50);
+    CREATE_AND_SET_IMAGE(mask10,U8,0,50,50)
+    CREATE_AND_SET_IMAGE(mask10i,U8,0,50,50)
+    psReadout *inReadout10 = psReadoutAlloc(0, 0, inImage10);
+    inReadout10->mask = mask10i;
+    pmMaskBadPixels(inReadout10, mask10, 0, 100.0, 1, 10);
+    psFree(mask10);
+    psFree(inReadout10);
+    psFree(inImage10);
+    printFooter(stdout, "pmMaskBadPixels", "Test J - Attempt to use complex input image", true);
+    printf("\n\n\n");
+
+
+    // Test K - Attempt to use non-mask type mask image
+    printNegativeTestHeader(stdout,"pmMaskBadPixels", "Test K - Attempt to use non-mask type mask image",
+                            "Mask must be PS_TYPE_MASK type", 0);
+    CREATE_AND_SET_IMAGE(inImage11,F64,50.0,50,50);
+    CREATE_AND_SET_IMAGE(mask11,F64,0,50,50)
+    CREATE_AND_SET_IMAGE(mask11i,U8,0,50,50)
+    psReadout *inReadout11 = psReadoutAlloc(0, 0, inImage10);
+    inReadout11->mask = mask11i;
+    pmMaskBadPixels(inReadout11, mask11, 0, 100.0, 1, 10);
+    psFree(mask11);
+    psFree(inReadout11);
+    psFree(inImage11);
+    printFooter(stdout, "pmMaskBadPixels", "Test K - Attempt to use non-mask type mask image", true);
+    printf("\n\n\n");
 
     return 0;
