Index: /trunk/psLib/test/astronomy/Makefile
===================================================================
--- /trunk/psLib/test/astronomy/Makefile	(revision 2063)
+++ /trunk/psLib/test/astronomy/Makefile	(revision 2064)
@@ -3,6 +3,6 @@
 ##  Makefile:   test/astronomy
 ##
-##  $Revision: 1.15 $  $Name: not supported by cvs2svn $
-##  $Date: 2004-10-12 22:46:08 $
+##  $Revision: 1.16 $  $Name: not supported by cvs2svn $
+##  $Date: 2004-10-12 23:06:08 $
 ##
 ##  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -28,6 +28,7 @@
          tst_psMetadata_05 \
          tst_psMetadata_06 \
+         tst_psAstrometry \
          tst_psAstrometry01 \
-         tst_psAstrometry \
+         tst_psAstrometry02
 
 OBJS = $(addprefix builddir/,$(addsuffix .o,$(TARGET)))
Index: /trunk/psLib/test/astronomy/tst_psAstrometry01.c
===================================================================
--- /trunk/psLib/test/astronomy/tst_psAstrometry01.c	(revision 2063)
+++ /trunk/psLib/test/astronomy/tst_psAstrometry01.c	(revision 2064)
@@ -1,3 +1,3 @@
-/** @file  tst_psImageManip.c
+/** @file  tst_psAstrometry01.c
 *
 *  @brief The code in this file will test the code in psAstrometry.[ch]
@@ -5,6 +5,6 @@
 *  @author GLG, MHPCC
 *
-*  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-10-12 20:54:17 $
+*  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-10-12 23:06:08 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -17,4 +17,105 @@
 static int test2( void );
 static int test3( void );
+
+testDescription tests[] = {
+                              {test1, 0000, "Tests psFixedPatternAlloc()", 0, false},
+                              {test2, 0000, "Tests psGrommitAlloc()", 0, false},
+                              {test3, 0000, "psFunctionBar", 0, false},
+                              {NULL}
+                          };
+#define RA  1.0
+#define DEC  2.0
+#define HA  3.0
+#define ZD  4.0
+#define AZ  5.0
+#define ROT_ANGLE 6.0
+#define TEMPERATURE 7.0
+#define PRESSURE 8.0
+#define HUMIDITY 20.0
+#define EXP_TIME 22.0
+#define WAVELENGTH 11.0
+#define NAME  "The Kaiser Royal Observatory"
+#define LATITUDE 20.7
+#define LONGITUDE 156.3
+#define HEIGHT  3055.0
+#define LAPSERATE 20.0
+#define NUM_CHIPS 2
+#define NUM_CELLS 4
+#define NUM_READOUTS 2
+#define READOUT_NUM_ROWS 8
+#define READOUT_NUM_COLS 8
+#define ROW0  0
+#define COL0  0
+
+int genSystem()
+{
+    int i;
+    int j;
+    int k;
+    psImage *tmpImage;
+    psTime* now = psTimeGetTime(PS_TIME_UTC);
+    psObservatory* obs = psObservatoryAlloc(NAME, LATITUDE, LONGITUDE, HEIGHT, LAPSERATE);
+    psExposure* exp = psExposureAlloc(RA, DEC, HA, ZD, AZ,
+                                      now, ROT_ANGLE, TEMPERATURE, PRESSURE, HUMIDITY,
+                                      EXP_TIME, WAVELENGTH, obs);
+    //    psGrommit *grom = psGrommitAlloc(exp);
+    psFPA *myFPA = psFPAAlloc(NUM_CHIPS, exp);
+    psChip **chips;
+    psCell **cells;
+    psReadout **readouts;
+
+    myFPA->fromTangentPlane = NULL;
+    myFPA->toTangentPlane = NULL;
+
+    chips = (psChip **) myFPA->chips->data;
+    for (i=0;i<NUM_CHIPS;i++) {
+        chips[i] = psChipAlloc(NUM_CELLS, myFPA);
+        chips[i]->toFPA = NULL;
+        chips[i]->fromFPA = NULL;
+        cells = (psCell **) chips[i]->cells->data;
+
+        for (j=0;j<NUM_CELLS;j++) {
+            cells[j] = psCellAlloc(NUM_READOUTS, chips[i]);
+            cells[j]->toChip = NULL;
+            cells[j]->fromChip = NULL;
+            cells[j]->toFPA = NULL;
+            cells[j]->toTP = NULL;
+            /*
+                        readouts = (psReadout **) cells[j]->readouts->data;
+                        for (k=0;k<NUM_READOUTS;k++) {
+                            tmpImage = psImageAlloc(READOUT_NUM_COLS, READOUT_NUM_ROWS, PS_TYPE_F32);
+                            readouts[k] = psReadoutAlloc(COL0, ROW0, tmpImage);
+                        }
+            */
+        }
+    }
+
+    psFree(now);
+    psFree(obs);
+    psFree(exp);
+    chips = (psChip **) myFPA->chips->data;
+    for (i=0;i<NUM_CHIPS;i++) {
+        cells = (psCell **) chips[i]->cells->data;
+        for (j=0;j<NUM_CELLS;j++) {
+            /*
+                        readouts = (psReadout **) cells[j]->readouts->data;
+                        for (k=0;k<NUM_READOUTS;k++) {
+                            psFree(readouts[k]);
+                        }
+            */
+            psFree(cells[j]);
+        }
+        psFree(chips[i]);
+    }
+    psFree(myFPA);
+    return(0);
+}
+
+int main( int argc, char* argv[] )
+{
+    psLogSetLevel( PS_LOG_INFO );
+
+    return ( ! runTestSuite( stderr, "psImage", tests, argc, argv ) );
+}
 
 #define X_NUM_ROWS 4
@@ -26,45 +127,4 @@
 #define X0  50.0
 #define Y0  60.0
-
-
-// test descrription consists of:
-//    * test function
-//
-//    * testpoint number (item number in gforge testpoint log)
-//
-//    * name of the testpoint
-//
-//    * expected return value (negative numbers are signal types, e.g.,
-//      -6 for aborts).  Usually either -6 (psAbort called) or 0.
-//
-//    * boolean to signify if the test function is already in list, i.e., if
-//      the test function covers multiple testpoints.  If true, the line is
-//      ignored by runTestSuite if the user didn't explicitly specify the
-//      testpoint with the -n or -t option, as to not run a test function
-//      multiple times.
-//
-testDescription tests[] = {
-                              {
-                                  test1, 1118, "psFunctionBar", 0, false
-                              },
-                              {
-                                  test2, 1113, "psFunctionFoo", 0, false
-                              },
-                              {
-                                  test3, 1114, "psFunctionFunk", 0, false
-                              },
-
-                              // A null terminates the testDescription list
-                              {
-                                  NULL
-                              }
-                          };
-
-int main( int argc, char* argv[] )
-{
-    psLogSetLevel( PS_LOG_INFO );
-
-    return ( ! runTestSuite( stderr, "psImage", tests, argc, argv ) );
-}
 
 int test1( void )
@@ -162,19 +222,83 @@
 }
 
-int test2( void )
-{
-    // no need to check for memory leaks, as the runTestSuite does that for you.
-
-    // here is where one implements the tests for generally a single testpoint.
-
-    return 0;  // the value that indicates success is part of the testDescription
+int test2()
+{
+    int testStatus = 0;
+
+    psTime* now = psTimeGetTime(PS_TIME_UTC);
+
+    psObservatory* obs = psObservatoryAlloc(NAME, LATITUDE, LONGITUDE, HEIGHT, LAPSERATE);
+
+    psExposure* exp = psExposureAlloc(RA, DEC, HA, ZD, AZ,
+                                      now, ROT_ANGLE, TEMPERATURE, PRESSURE, HUMIDITY,
+                                      EXP_TIME, WAVELENGTH, obs);
+
+    psGrommit *grom = psGrommitAlloc(exp);
+
+    if (grom->height != HEIGHT) {
+        printf("ERROR: grom->height is %f, should be %f\n", grom->height, HEIGHT);
+        testStatus = 1;
+    }
+    if (grom->temperature != TEMPERATURE) {
+        printf("ERROR: grom->temperature is %f, should be %f\n", grom->temperature, TEMPERATURE);
+        testStatus = 2;
+    }
+
+    if (grom->pressure != PRESSURE) {
+        printf("ERROR: grom->pressure is %f, should be %f\n", grom->pressure, PRESSURE);
+        testStatus = 3;
+    }
+
+    if (grom->humidity != HUMIDITY) {
+        printf("ERROR: grom->humidity is %f, should be %f\n", grom->humidity, HUMIDITY);
+        testStatus = 4;
+    }
+
+    if (grom->wavelength != WAVELENGTH) {
+        printf("ERROR: grom->wavelength is %f, should be %f\n", grom->wavelength, WAVELENGTH);
+        testStatus = 5;
+    }
+
+    if (grom->lapseRate != LAPSERATE) {
+        printf("ERROR: grom->lapseRate is %f, should be %f\n", grom->lapseRate, LAPSERATE);
+        testStatus = 6;
+    }
+
+    /*
+        XXX: Don't know how to verify: latitude, sinLat, cosLat, abberationMag,
+             refractA, refractB, longitudeOffset, siderealTime
+     
+       if (grom-> != ) {
+            printf("ERROR: grom-> is %f, should be %f\n", grom->, );
+            testStatus = 1;
+       }
+    */
+
+    printf("grom->latitude is %f\n", grom->latitude);
+    printf("grom->sinLat is %f\n", grom->sinLat);
+    printf("grom->cosLat is %f\n", grom->cosLat);
+    printf("grom->abberationMag is %f\n", grom->abberationMag);
+    printf("grom->height is %f\n", grom->height);
+    printf("grom->temperature is %f\n", grom->temperature);
+    printf("grom->pressure is %f\n", grom->pressure);
+    printf("grom->humidity is %f\n", grom->humidity);
+    printf("grom->wavelength is %f\n", grom->wavelength);
+    printf("grom->lapseRate is %f\n", grom->lapseRate);
+    printf("grom->refractA is %f\n", grom->refractA);
+    printf("grom->refractB is %f\n", grom->refractB);
+    printf("grom->longitudeOffset is %f\n", grom->longitudeOffset);
+    printf("grom->siderealTime is %f\n", grom->siderealTime);
+
+    psFree(now);
+    psFree(obs);
+    psFree(exp);
+    psFree(grom);
+
+    return(testStatus);
 }
 
 int test3( void )
 {
-    // no need to check for memory leaks, as the runTestSuite does that for you.
-
-    // here is where one implements the tests for generally a single testpoint.
-
-    return 0;  // the value that indicates success is part of the testDescription
-}
+    genSystem();
+    return(0);
+}
Index: /trunk/psLib/test/astronomy/tst_psAstrometry02.c
===================================================================
--- /trunk/psLib/test/astronomy/tst_psAstrometry02.c	(revision 2064)
+++ /trunk/psLib/test/astronomy/tst_psAstrometry02.c	(revision 2064)
@@ -0,0 +1,81 @@
+#include "psTest.h"
+#include "pslib.h"
+static int test1( void );
+
+testDescription tests[] = {
+                              {test1, 0000, "Hey", 0, false},
+                              {NULL}
+                          };
+#define RA  1.0
+#define DEC  2.0
+#define HA  3.0
+#define ZD  4.0
+#define AZ  5.0
+#define ROT_ANGLE 6.0
+#define TEMPERATURE 7.0
+#define PRESSURE 8.0
+#define HUMIDITY 20.0
+#define EXP_TIME 22.0
+#define WAVELENGTH 11.0
+#define NAME  "The Kaiser Royal Observatory"
+#define LATITUDE 20.7
+#define LONGITUDE 156.3
+#define HEIGHT  3055.0
+#define LAPSERATE 20.0
+#define NUM_CHIPS 2
+#define NUM_CELLS 4
+#define NUM_READOUTS 2
+#define READOUT_NUM_ROWS 8
+#define READOUT_NUM_COLS 8
+#define ROW0  0
+#define COL0  0
+
+int genSystem()
+{
+    int i;
+    int j;
+    psImage *tmpImage;
+    psTime* now = psTimeGetTime(PS_TIME_UTC);
+    psObservatory* obs = psObservatoryAlloc(NAME, LATITUDE, LONGITUDE, HEIGHT, LAPSERATE);
+    psExposure* exp = psExposureAlloc(RA, DEC, HA, ZD, AZ,
+                                      now, ROT_ANGLE, TEMPERATURE, PRESSURE, HUMIDITY,
+                                      EXP_TIME, WAVELENGTH, obs);
+    psFPA *myFPA = psFPAAlloc(NUM_CHIPS, exp);
+    psChip **chips;
+    psCell **cells;
+
+    myFPA->fromTangentPlane = NULL;
+    myFPA->toTangentPlane = NULL;
+
+    chips = (psChip **) myFPA->chips->data;
+    for (i=0;i<NUM_CHIPS;i++) {
+        chips[i] = psChipAlloc(NUM_CELLS, myFPA);
+        cells = (psCell **) chips[i]->cells->data;
+
+        for (j=0;j<NUM_CELLS;j++) {
+            cells[j] = psCellAlloc(NUM_READOUTS, chips[i]);
+        }
+    }
+
+    chips = (psChip **) myFPA->chips->data;
+    for (i=0;i<NUM_CHIPS;i++) {
+        cells = (psCell **) chips[i]->cells->data;
+        for (j=0;j<NUM_CELLS;j++) {
+            psFree(cells[j]);
+        }
+        psFree(chips[i]);
+    }
+
+    return(0);
+}
+
+int main( int argc, char* argv[] )
+{
+    return ( ! runTestSuite( stderr, "psImage", tests, argc, argv ) );
+}
+
+int test1( void )
+{
+    genSystem();
+    return(0);
+}
