Index: trunk/psModules/test/tst_pmReadoutCombine.c
===================================================================
--- trunk/psModules/test/tst_pmReadoutCombine.c	(revision 2816)
+++ trunk/psModules/test/tst_pmReadoutCombine.c	(revision 2829)
@@ -5,6 +5,6 @@
  *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-12-24 00:58:08 $
+ *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-12-27 20:14:29 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -118,7 +118,9 @@
            minOutRow, minOutCol, maxOutRow, maxOutCol);
 
-    output = pmReadoutCombine(output, list, params, zero, scale, true, 1.0, 0.0);
+    output = pmReadoutCombine(output, list, params, zero, scale, true, 0.0, 0.0);
     psF32 NR = (psF32) NUM_READOUTS;
-    psF32 expectedPixel = ((((NR-1.0) * (NR/2.0)) / NR) + VEC_ZERO) * VEC_SCALE;
+    //    psF32 expectedPixel = ((((NR-1.0) * (NR/2.0)) / NR) + VEC_ZERO) * VEC_SCALE;
+    psF32 expectedPixel = ((NR/2.0) * (VEC_ZERO + (VEC_ZERO + VEC_SCALE * (NR - 1)))) / NR;
+
     VerifyTheOutput(output, expectedPixel);
 
@@ -179,8 +181,12 @@
         zero->data.F32[i] = 3.0;
         zeroBig->data.F32[i] = 3.0;
+        zero->data.F32[i] = VEC_ZERO;
+        zeroBig->data.F32[i] = VEC_ZERO;
     }
     for (i=0;i<NUM_READOUTS;i++) {
         scale->data.F32[i] = 6.0;
         scaleBig->data.F32[i] = 6.0;
+        scale->data.F32[i] = VEC_SCALE;
+        scaleBig->data.F32[i] = VEC_SCALE;
     }
 
@@ -220,19 +226,26 @@
     printf("----------------------------------------------------------------------------\n");
     printf("Calling pmReadoutCombine() with NULL zero vector.\n");
-    rc = pmReadoutCombine(NULL, list, params, NULL, scale, true, 1.0, 0.0);
-    if (rc == NULL) {
-        //XXX: We should verify the output image here.
+    rc = pmReadoutCombine(NULL, list, params, NULL, scale, true, 0.0, 0.0);
+    if (rc != NULL) {
+        psF32 NR = (psF32) NUM_READOUTS;
+        psF32 expectedPixel = ((NR/2.0) * (0.0 + (0.0 + VEC_SCALE * (NR - 1)))) / NR;
+        if (false == VerifyTheOutput(rc, expectedPixel)) {
+            testStatus = false;
+        }
+
+        if (rc->type.type != scale->type.type) {
+            printf("ERROR: output readout->image has incorrect type.\n");
+            testStatus = false;
+        }
+        psFree(rc);
+    } else {
         printf("ERROR: pmReadoutCombine() returned NULL\n");
         testStatus = false;
-    }
-    if (rc->type.type != scale->type.type) {
-        printf("ERROR: output readout->image has incorrect type.\n");
-        testStatus = false;
-    }
-    psFree(rc);
+
+    }
 
     printf("----------------------------------------------------------------------------\n");
     printf("Calling pmReadoutCombine() with incorrect length zero vector (too small).  Should generate error.\n");
-    rc = pmReadoutCombine(NULL, list, params, zeroHalf, scale, true, 1.0, 0.0);
+    rc = pmReadoutCombine(NULL, list, params, zeroHalf, scale, true, 0.0, 0.0);
     if (rc != NULL) {
         printf("ERROR: pmReadoutCombine() did not return NULL\n");
@@ -242,5 +255,5 @@
     printf("----------------------------------------------------------------------------\n");
     printf("Calling pmReadoutCombine() with incorrect type zero vector.  Should generate error.\n");
-    rc = pmReadoutCombine(NULL, list, params, zeroF64, scale, true, 1.0, 0.0);
+    rc = pmReadoutCombine(NULL, list, params, zeroF64, scale, true, 0.0, 0.0);
     if (rc != NULL) {
         printf("ERROR: pmReadoutCombine() did not return NULL\n");
@@ -250,7 +263,10 @@
     printf("----------------------------------------------------------------------------\n");
     printf("Calling pmReadoutCombine() with incorrect length zero vector (too big).  Should generate warning.\n");
-    rc = pmReadoutCombine(output, list, params, zeroBig, scale, true, 1.0, 0.0);
-    if (rc != NULL) {
-        if (false == VerifyTheOutput(rc, 45.0)) {
+    rc = pmReadoutCombine(output, list, params, zeroBig, scale, true, 0.0, 0.0);
+    if (rc != NULL) {
+        psF32 NR = (psF32) NUM_READOUTS;
+        psF32 expectedPixel = ((NR/2.0) * (VEC_ZERO + (VEC_ZERO + VEC_SCALE * (NR - 1)))) / NR;
+
+        if (false == VerifyTheOutput(rc, expectedPixel)) {
             testStatus = false;
         }
@@ -264,15 +280,27 @@
     printf("----------------------------------------------------------------------------\n");
     printf("Calling pmReadoutCombine() with NULL scale vector.\n");
-    rc = pmReadoutCombine(output, list, params, zero, NULL, true, 1.0, 0.0);
-    if (rc == NULL) {
-        //XXX: We should verify the output image here.
+    rc = pmReadoutCombine(output, list, params, zero, NULL, true, 0.0, 0.0);
+
+    if (rc != NULL) {
+        psF32 NR = (psF32) NUM_READOUTS;
+        psF32 expectedPixel = ((NR/2.0) * (VEC_ZERO + (VEC_ZERO + 1.0 * (NR - 1)))) / NR;
+        if (false == VerifyTheOutput(rc, expectedPixel)) {
+            testStatus = false;
+        }
+
+        if (rc->type.type != scale->type.type) {
+            printf("ERROR: output readout->image has incorrect type.\n");
+            testStatus = false;
+        }
+        psFree(rc);
+    } else {
         printf("ERROR: pmReadoutCombine() returned NULL\n");
         testStatus = false;
-    }
-    psFree(rc);
+
+    }
 
     printf("----------------------------------------------------------------------------\n");
     printf("Calling pmReadoutCombine() with incorrect length scale vector (too small).  Should generate error.\n");
-    rc = pmReadoutCombine(output, list, params, zero, scaleHalf, true, 1.0, 0.0);
+    rc = pmReadoutCombine(output, list, params, zero, scaleHalf, true, 0.0, 0.0);
     if (rc != NULL) {
         printf("ERROR: pmReadoutCombine() did not return NULL\n");
@@ -282,5 +310,5 @@
     printf("----------------------------------------------------------------------------\n");
     printf("Calling pmReadoutCombine() with incorrect type scale vector.  Should generate error.\n");
-    rc = pmReadoutCombine(output, list, params, zero, scaleF64, true, 1.0, 0.0);
+    rc = pmReadoutCombine(output, list, params, zero, scaleF64, true, 0.0, 0.0);
     if (rc != NULL) {
         printf("ERROR: pmReadoutCombine() did not return NULL\n");
@@ -290,7 +318,10 @@
     printf("----------------------------------------------------------------------------\n");
     printf("Calling pmReadoutCombine() with incorrect length scale vector (too big).  Should generate warning.\n");
-    rc = pmReadoutCombine(output, list, params, zero, scaleBig, true, 1.0, 0.0);
-    if (rc != NULL) {
-        if (false == VerifyTheOutput(rc, 45.0)) {
+    rc = pmReadoutCombine(output, list, params, zero, scaleBig, true, 0.0, 0.0);
+    if (rc != NULL) {
+        psF32 NR = (psF32) NUM_READOUTS;
+        psF32 expectedPixel = ((NR/2.0) * (VEC_ZERO + (VEC_ZERO + VEC_SCALE * (NR - 1)))) / NR;
+
+        if (false == VerifyTheOutput(rc, expectedPixel)) {
             testStatus = false;
         }
@@ -305,5 +336,5 @@
     printf("Calling pmReadoutCombine() insufficient size output image.  Should generate error, return NULL.\n");
     output = psImageAlloc(1, 1, PS_TYPE_F32);
-    rc = pmReadoutCombine(output, list, params, zero, scale, true, 1.0, 0.0);
+    rc = pmReadoutCombine(output, list, params, zero, scale, true, 0.0, 0.0);
     if (rc != NULL) {
         printf("ERROR: pmReadoutCombine() did not return NULL\n");
@@ -315,5 +346,5 @@
     printf("----------------------------------------------------------------------------\n");
     printf("Calling pmReadoutCombine() with NULL input list.  Should generate error, return NULL.\n");
-    rc = pmReadoutCombine(output, NULL, params, zero, scale, true, 1.0, 0.0);
+    rc = pmReadoutCombine(output, NULL, params, zero, scale, true, 0.0, 0.0);
     if (rc != NULL) {
         printf("ERROR: pmReadoutCombine() did not return NULL\n");
@@ -323,5 +354,5 @@
     printf("----------------------------------------------------------------------------\n");
     printf("Calling pmReadoutCombine() with NULL params.  Should generate error, return NULL.\n");
-    rc = pmReadoutCombine(output, list, NULL, zero, scale, true, 1.0, 0.0);
+    rc = pmReadoutCombine(output, list, NULL, zero, scale, true, 0.0, 0.0);
     if (rc != NULL) {
         printf("ERROR: pmReadoutCombine() did not return NULL\n");
@@ -332,5 +363,5 @@
     psStatsOptions oldStatsOpts = params->stats->options |= PS_STAT_MIN;
     printf("Calling pmReadoutCombine() with multiple stats->options.  Should generate error, return NULL.\n");
-    rc = pmReadoutCombine(output, list, params, zero, scale, true, 1.0, 0.0);
+    rc = pmReadoutCombine(output, list, params, zero, scale, true, 0.0, 0.0);
     if (rc != NULL) {
         printf("ERROR: pmReadoutCombine() did not return NULL\n");
@@ -342,5 +373,5 @@
     psStats *oldStats = params->stats;
     printf("Calling pmReadoutCombine() with NULL param->stats.  Should generate error, return NULL.\n");
-    rc = pmReadoutCombine(output, list, params, zero, scale, true, 1.0, 0.0);
+    rc = pmReadoutCombine(output, list, params, zero, scale, true, 0.0, 0.0);
     if (rc != NULL) {
         printf("ERROR: pmReadoutCombine() did not return NULL\n");
