Index: trunk/psModules/test/tst_pmNonLinear.c
===================================================================
--- trunk/psModules/test/tst_pmNonLinear.c	(revision 2955)
+++ trunk/psModules/test/tst_pmNonLinear.c	(revision 2956)
@@ -16,6 +16,6 @@
  *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-01-11 19:38:24 $
+ *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-01-11 20:47:39 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -243,5 +243,5 @@
         outBig->data.F32[i] = (float) (2 * i);
         if (i < tableSize-1) {
-            inSmall->data.F32[i] = (float) (2 * i);
+            inSmall->data.F32[i] = (float) i;
             outSmall->data.F32[i] = (float) (2 * i);
         }
@@ -315,4 +315,14 @@
         testStatus = false;
     }
+    for (i=0;i<NUM_ROWS;i++) {
+        for (j=0;j<NUM_COLS;j++) {
+            psF32 expect = (float) (2 * (i + j));
+            psF32 actual = rc->image->data.F32[i][j];
+            if (FLT_EPSILON < fabs(expect - actual)) {
+                printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
+                testStatus = false;
+            }
+        }
+    }
 
     test03Init(myReadout);
@@ -324,4 +334,14 @@
         testStatus = false;
     }
+    for (i=0;i<NUM_ROWS;i++) {
+        for (j=0;j<NUM_COLS;j++) {
+            psF32 expect = (float) (2 * (i + j));
+            psF32 actual = rc->image->data.F32[i][j];
+            if (FLT_EPSILON < fabs(expect - actual)) {
+                printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
+                testStatus = false;
+            }
+        }
+    }
 
     test03Init(myReadout);
@@ -333,4 +353,14 @@
         testStatus = false;
     }
+    for (i=0;i<NUM_ROWS;i++) {
+        for (j=0;j<NUM_COLS;j++) {
+            psF32 expect = (float) (2 * (i + j));
+            psF32 actual = rc->image->data.F32[i][j];
+            if (FLT_EPSILON < fabs(expect - actual)) {
+                printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
+                testStatus = false;
+            }
+        }
+    }
 
     test03Init(myReadout);
@@ -342,4 +372,14 @@
         testStatus = false;
     }
+    for (i=0;i<NUM_ROWS;i++) {
+        for (j=0;j<NUM_COLS;j++) {
+            psF32 expect = (float) (2 * (i + j));
+            psF32 actual = rc->image->data.F32[i][j];
+            if (FLT_EPSILON < fabs(expect - actual)) {
+                printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
+                testStatus = false;
+            }
+        }
+    }
 
     test03Init(myReadout);
@@ -350,4 +390,14 @@
         printf("TEST ERROR: pmNonLinearityPolynomial() returned a NULL psReadout\n");
         testStatus = false;
+    }
+    for (i=0;i<NUM_ROWS;i++) {
+        for (j=0;j<NUM_COLS;j++) {
+            psF32 expect = (float) (2 * (i + j));
+            psF32 actual = rc->image->data.F32[i][j];
+            if (FLT_EPSILON < fabs(expect - actual)) {
+                printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
+                testStatus = false;
+            }
+        }
     }
 
@@ -360,4 +410,14 @@
         testStatus = false;
     }
+    for (i=0;i<NUM_ROWS;i++) {
+        for (j=0;j<NUM_COLS;j++) {
+            psF32 expect = (float) ((i + j));
+            psF32 actual = rc->image->data.F32[i][j];
+            if (FLT_EPSILON < fabs(expect - actual)) {
+                printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
+                testStatus = false;
+            }
+        }
+    }
 
     printf("------------------------------------------------------------\n");
@@ -370,5 +430,46 @@
         testStatus = false;
     }
-
+    for (i=0;i<NUM_ROWS;i++) {
+        for (j=0;j<NUM_COLS;j++) {
+            psF32 expect = (float) (2 * (i + j));
+            psF32 actual = rc->image->data.F32[i][j];
+            if(i==0 && j==0) {
+                if(actual != 0.0) {
+                    printf("TEST ERROR: image[%d][%d] is %f, should be %f\n",i,j,actual,0.0);
+                }
+            } else {
+                if (FLT_EPSILON < fabs(expect - actual)) {
+                    printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
+                    testStatus = false;
+                }
+            }
+        }
+    }
+
+    printf("------------------------------------------------------------\n");
+    printf("Calling pmNonLinearityLookup() with one pixels outside inFlux range.  Should generate warnings.\n");
+    test03Init(myReadout);
+    myReadout->image->data.F32[NUM_ROWS-1][NUM_COLS-1] = 100;
+    rc = pmNonLinearityLookup(myReadout, in, out);
+    if (rc == NULL) {
+        printf("TEST ERROR: pmNonLinearityPolynomial() returned a NULL psReadout\n");
+        testStatus = false;
+    }
+    for (i=0;i<NUM_ROWS;i++) {
+        for (j=0;j<NUM_COLS;j++) {
+            psF32 expect = (float) (2 * (i + j));
+            psF32 actual = rc->image->data.F32[i][j];
+            if(i==(NUM_ROWS-1) && j==(NUM_COLS-1)) {
+                if(actual != (tableSize-1)*2) {
+                    printf("TEST ERROR: image[%d][%d] is %f, should be %f\n",i,j,actual,(tableSize-1)*2);
+                }
+            } else {
+                if (FLT_EPSILON < fabs(expect - actual)) {
+                    printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
+                    testStatus = false;
+                }
+            }
+        }
+    }
 
     psFree(myReadout);
