Index: /trunk/psLib/test/astronomy/tst_psAstrometry.c
===================================================================
--- /trunk/psLib/test/astronomy/tst_psAstrometry.c	(revision 2055)
+++ /trunk/psLib/test/astronomy/tst_psAstrometry.c	(revision 2056)
@@ -5,6 +5,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-10-12 19:28:40 $
+ *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-10-12 19:51:53 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -22,4 +22,5 @@
 static int testChipAlloc(void);
 static int testCellAlloc(void);
+static int testReadoutAlloc(void);
 
 testDescription tests[] = {
@@ -29,4 +30,5 @@
                               {testChipAlloc,740,"psChipAlloc",0,false},
                               {testCellAlloc,741,"psCellAlloc",0,false},
+                              {testReadoutAlloc,742,"psReadoutAlloc",0,false},
                               {NULL}
                           };
@@ -376,4 +378,5 @@
             return 3;
         }
+        chip->cells->data[lcv] = psAlloc(4); // to check if these are freed.
     }
 
@@ -395,4 +398,5 @@
         return 6;
     }
+    chip->metadata = psAlloc(4); // to check if these are freed.
 
     if (chip->toFPA != NULL) {
@@ -401,4 +405,5 @@
         return 7;
     }
+    chip->toFPA = psAlloc(4); // to check if these are freed.
 
     if (chip->fromFPA != NULL) {
@@ -407,4 +412,5 @@
         return 8;
     }
+    chip->fromFPA = psAlloc(4); // to check if these are freed.
 
     /*
@@ -522,4 +528,5 @@
             return 3;
         }
+        cell1->readouts->data[lcv] = psAlloc(4); // to check if these are freed.
     }
 
@@ -541,4 +548,5 @@
         return 6;
     }
+    cell1->metadata = psAlloc(4); // to check if these are freed.
 
     if (cell1->toChip != NULL) {
@@ -547,4 +555,5 @@
         return 7;
     }
+    cell1->toChip = psAlloc(4); // to check if these are freed.
 
     if (cell1->fromChip != NULL) {
@@ -553,4 +562,5 @@
         return 8;
     }
+    cell1->fromChip = psAlloc(4); // to check if these are freed.
 
     if (cell1->toFPA != NULL) {
@@ -559,4 +569,5 @@
         return 9;
     }
+    cell1->toFPA = psAlloc(4); // to check if these are freed.
 
     if (cell1->toTP != NULL) {
@@ -565,4 +576,5 @@
         return 10;
     }
+    cell1->toTP = psAlloc(4); // to check if these are freed.
 
     /*
@@ -628,2 +640,90 @@
     return 0;
 }
+
+static int testReadoutAlloc(void)
+{
+    psImage* image = psImageAlloc(64,64,PS_TYPE_S8);
+
+
+    /*
+        1. invoke psReadoutAlloc with unique/non-zero x0,y0 and non-NULL image. Verify that:
+        a. col0 & row0 are set to the parameters x0 and y0, respectively.
+        b. image attribute is set to image parameter and referenece is incremented
+        c. mask, objects, and metadata attributes are all NULL
+    */
+    psReadout* readout = psReadoutAlloc(1,2,image);
+
+    if (readout == NULL) {
+        psLogMsg(__func__,PS_LOG_ERROR,"psReadoutAlloc returned NULL.");
+        return 1;
+    }
+
+    if (readout->col0 != 1) {
+        psLogMsg(__func__,PS_LOG_ERROR,
+                 "psReadoutAlloc did not set col0 properly.");
+        return 2;
+    }
+
+    if (readout->row0 != 2) {
+        psLogMsg(__func__,PS_LOG_ERROR,
+                 "psReadoutAlloc did not set row0 properly.");
+        return 3;
+    }
+
+    if (readout->image != image) {
+        psLogMsg(__func__,PS_LOG_ERROR,
+                 "psReadoutAlloc did not set the image properly.");
+        return 4;
+    }
+
+    if (psMemGetRefCounter(image) != 2) {
+        psLogMsg(__func__,PS_LOG_ERROR,
+                 "psReadoutAlloc did not increment reference counter for image.");
+        return 5;
+    }
+
+    if (readout->metadata != NULL) {
+        psLogMsg(__func__,PS_LOG_ERROR,
+                 "psReadoutAlloc did not set metadata to NULL.");
+        return 6;
+    }
+    readout->metadata = psAlloc(4); // to check if these are freed.
+
+    if (readout->mask != NULL) {
+        psLogMsg(__func__,PS_LOG_ERROR,
+                 "psReadoutAlloc did not set mask to NULL.");
+        return 7;
+    }
+    readout->mask = psAlloc(4); // to check if these are freed.
+
+    if (readout->objects != NULL) {
+        psLogMsg(__func__,PS_LOG_ERROR,
+                 "psReadoutAlloc did not set objects to NULL.");
+        return 8;
+    }
+    readout->objects = psAlloc(4); // to check if these are freed.
+
+    /*
+        2. invoke psReadoutAlloc with NULL image. Verify that:
+        a. execution does not halt
+        b. the image attribute is NULL.
+    */
+
+    psReadout* readout2 = psReadoutAlloc(3,4,NULL);
+
+    if (readout2 == NULL) {
+        psLogMsg(__func__,PS_LOG_ERROR,"psReadoutAlloc returned NULL.");
+        return 11;
+    }
+
+    if (readout2->image != NULL) {
+        psLogMsg(__func__,PS_LOG_ERROR,"psReadoutAlloc didn't set image to NULL, as given.");
+        return 12;
+    }
+
+    psFree(readout);
+    psFree(readout2);
+    psFree(image);
+
+    return 0;
+}
