Index: trunk/psLib/test/astronomy/tst_psAstrometry.c
===================================================================
--- trunk/psLib/test/astronomy/tst_psAstrometry.c	(revision 2041)
+++ trunk/psLib/test/astronomy/tst_psAstrometry.c	(revision 2048)
@@ -5,6 +5,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-10-07 19:51:30 $
+ *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-10-12 01:34:09 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -19,8 +19,11 @@
 static int testExposureAlloc(void);
 static int testObservatoryAlloc(void);
+static int testFPAAlloc(void);
+// static int testGrommitAlloc(void);
 
 testDescription tests[] = {
                               {testExposureAlloc,735,"psExposureAlloc",0,false},
                               {testObservatoryAlloc,736,"psObservatoryAlloc",0,false},
+                              {testFPAAlloc,739,"psFPAAlloc",0,false},
                               {NULL}
                           };
@@ -119,12 +122,12 @@
     char* name = "The Kaiser Royal Observatory";
     psObservatory* obs = psObservatoryAlloc(name,
-                                            20.7, 156.3, 3055.0, 9.0);
-
-    if (fabs(obs->latitude - 20.7) > DBL_EPSILON) {
+                                            20.7*M_PI/180.0, 156.3*M_PI/180.0, 3055.0, 9.0);
+
+    if (fabs(obs->latitude - 20.7*M_PI/180.0) > DBL_EPSILON) {
         psLogMsg(__func__,PS_LOG_ERROR,"psObservatoryAlloc did not set latitude.");
         return 1;
     }
 
-    if (fabs(obs->longitude - 156.3) > DBL_EPSILON) {
+    if (fabs(obs->longitude - 156.3*M_PI/180.0) > DBL_EPSILON) {
         psLogMsg(__func__,PS_LOG_ERROR,"psObservatoryAlloc did not set longitude.");
         return 2;
@@ -152,5 +155,5 @@
 
     psObservatory* obs2 = psObservatoryAlloc(NULL,
-                          20.7, 156.3, 3055.0, 9.0);
+                          20.7*M_PI/180.0, 156.3*M_PI/180.0, 3055.0, 9.0);
 
     if (obs2->name != NULL) {
@@ -164,2 +167,157 @@
     return 0;
 }
+
+static int testFPAAlloc(void)
+{
+
+    psTime* now = psTimeGetTime(PS_TIME_UTC);
+    char* name = "The Kaiser Royal Observatory";
+
+    psObservatory* obs = psObservatoryAlloc(name,
+                                            20.7*M_PI/180.0, 156.3*M_PI/180.0, 3055.0, 0.0065f);
+
+    psExposure* exp = psExposureAlloc(1.0, 2.0, 3.0, 4.0, 5.0,
+                                      now, 6.0f, 260.0f, 1013.0f, 0.7f, 10.0f, 0.650f, obs);
+
+    /*
+        1. Call psFPAAlloc with nChips > 0 and a non-NULL psExposure.
+        a) Verify that the psExposure reference is: 1. is set in struct as
+        exposure; 2. its reference count is incremented.
+        b) Verify that the chip attribute is of the size specified by the
+        parameter nChips and that the chips array elements are all NULL.
+        c) verify that all other references in the struct is NULL.
+    */
+
+    psFPA* fpa = psFPAAlloc(8, exp);
+
+    if (fpa == NULL) {
+        psLogMsg(__func__,PS_LOG_ERROR,
+                 "psFPAAlloc returned a NULL.");
+        return 1;
+    }
+
+    if (fpa->exposure != exp) {
+        psLogMsg(__func__,PS_LOG_ERROR,
+                 "psFPAAlloc did not set the exposure.");
+        return 2;
+    }
+
+    if (psMemGetRefCounter(exp) != 2) {
+        psLogMsg(__func__,PS_LOG_ERROR,
+                 "psFPAAlloc did not increment reference counter for exposure.");
+        return 3;
+    }
+
+    if (fpa->chips->n != 8) {
+        psLogMsg(__func__,PS_LOG_ERROR,
+                 "psFPAAlloc did not set the number of chips properly.");
+        return 4;
+    }
+
+    for (int lcv=0; lcv < 8; lcv++) {
+        if (fpa->chips->data[lcv] != NULL) {
+            psLogMsg(__func__,PS_LOG_ERROR,
+                     "psFPAAlloc did not set chip %d to NULL.", lcv);
+            return 5;
+        }
+    }
+
+    if (fpa->metadata != NULL) {
+        psLogMsg(__func__,PS_LOG_ERROR,
+                 "psFPAAlloc did not set metadata to NULL.");
+        return 6;
+    }
+
+    if (fpa->fromTangentPlane != NULL) {
+        psLogMsg(__func__,PS_LOG_ERROR,
+                 "psFPAAlloc did not set fromTangentPlane to NULL.");
+        return 7;
+    }
+
+    if (fpa->toTangentPlane != NULL) {
+        psLogMsg(__func__,PS_LOG_ERROR,
+                 "psFPAAlloc did not set toTangentPlane to NULL.");
+        return 8;
+    }
+
+    if (fpa->pattern != NULL) {
+        psLogMsg(__func__,PS_LOG_ERROR,
+                 "psFPAAlloc did not set pattern to NULL.");
+        return 9;
+    }
+
+    if (fpa->grommit == NULL) {
+        psLogMsg(__func__,PS_LOG_ERROR,
+                 "psFPAAlloc did not set grommit using given exposure.");
+        return 10;
+    }
+
+    if (fpa->colorPlus != NULL) {
+        psLogMsg(__func__,PS_LOG_ERROR,
+                 "psFPAAlloc did not set colorPlus to NULL.");
+        return 11;
+    }
+
+    if (fpa->colorMinus != NULL) {
+        psLogMsg(__func__,PS_LOG_ERROR,
+                 "psFPAAlloc did not set colorMinus to NULL.");
+        return 12;
+    }
+
+    if (fpa->projection != NULL) {
+        psLogMsg(__func__,PS_LOG_ERROR,
+                 "psFPAAlloc did not set projection to NULL.");
+        return 13;
+    }
+
+    /*
+        2. Call psFPAAlloc with nChips = 0. Verify that the chips array is 
+           zero in size and the program execution does not stop.
+    */
+
+    psFPA* fpa2 = psFPAAlloc(0,exp);
+
+    if (fpa2->chips->n != 0) {
+        psLogMsg(__func__,PS_LOG_ERROR,
+                 "psFPAAlloc did not set the number of chips properly.");
+        return 14;
+    }
+
+    /*
+        3. Call psFPAAlloc with a NULL psExposure. Verify that the program 
+           execution doe not stop and the exposure attribute is NULL.
+    */
+
+    psFPA* fpa3 = psFPAAlloc(4,NULL);
+    if (fpa3->exposure != NULL) {
+        psLogMsg(__func__,PS_LOG_ERROR,
+                 "psFPAAlloc did not set the exposure to NULL given NULL parameter.");
+        return 15;
+    }
+
+    /*
+        4. Call psFPAAlloc and set all references in the struct to a memory 
+           buffer. Verify that psFree cleans up all the buffers referenced in 
+           the struct, i.e., there is no memory leaks generated.
+    */
+
+    for (int lcv=0; lcv < 8; lcv++) {
+        fpa->chips->data[lcv] = psAlloc(4);
+    }
+
+    fpa->metadata = psAlloc(4);
+    fpa->fromTangentPlane = psAlloc(4);
+    fpa->toTangentPlane = psAlloc(4);
+    fpa->pattern = psAlloc(4);
+    fpa->colorPlus  = psAlloc(4);
+    fpa->colorMinus  = psAlloc(4);
+    fpa->projection  = psAlloc(4);
+
+    psFree(fpa3);
+    psFree(fpa2);
+    psFree(fpa);
+    psFree(exp);
+    psFree(obs);
+
+    return 0;
+}
Index: trunk/psLib/test/astronomy/tst_psTime_01.c
===================================================================
--- trunk/psLib/test/astronomy/tst_psTime_01.c	(revision 2041)
+++ trunk/psLib/test/astronomy/tst_psTime_01.c	(revision 2048)
@@ -23,6 +23,6 @@
  *  @author  Ross Harman, MHPCC
  *
- *  @version $Revision: 1.11 $  $Name: not supported by cvs2svn $
- *  @date  $Date: 2004-10-08 23:30:47 $
+ *  @version $Revision: 1.12 $  $Name: not supported by cvs2svn $
+ *  @date  $Date: 2004-10-12 01:34:09 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -62,5 +62,5 @@
     printPositiveTestHeader(stdout,"psTime", "Convert psTime to ISO time");
     char *isoString;
-    isoString = psTimeToISO(testTime);
+    isoString = psTimeToISOTime(testTime);
     printf("%s\n", isoString);
     if(strncmp(isoString, testString, 256)) {
@@ -74,5 +74,5 @@
     printPositiveTestHeader(stdout,"psTime", "Convert ISO time to psTime");
     psTime *timeD = NULL;
-    timeD = psISOToTime(isoString);
+    timeD = psTimeFromISOTime(isoString);
     printf("psTime: Seconds = %ld Microseconds = %d\n", (long)timeD->sec, (psU32)timeD->usec);
     psFree(isoString);
@@ -118,5 +118,5 @@
     printPositiveTestHeader(stdout,"psTime", "Convert MJD time to psTime");
     psTime *timeH = NULL;
-    timeH = psMJDToTime(mjdTime);
+    timeH = psTimeFromMJD(mjdTime);
     printf("psTime: Seconds = %ld Microseconds = %d\n", (long)timeH->sec, (psU32)timeH->usec);
     psFree(timeH);
@@ -135,5 +135,5 @@
     printPositiveTestHeader(stdout,"psTime", "Convert JD time to psTime");
     psTime *timeJ = NULL;
-    timeJ = psJDToTime(jdTime);
+    timeJ = psTimeFromJD(jdTime);
     printf("psTime: Seconds = %ld Microseconds = %d\n", (long)timeJ->sec, (psU32)timeJ->usec);
     psFree(timeJ);
@@ -152,5 +152,5 @@
     printPositiveTestHeader(stdout,"psTime", "Convert timeval time to psTime");
     psTime *timeL = NULL;
-    timeL = psTimevalToTime(&timevalTime);
+    timeL = psTimeFromTimeval(&timevalTime);
     printf("psTime: Seconds = %ld Microseconds = %d\n", (long)timeL->sec, (psU32)timeL->usec);
     psFree(timeL);
@@ -175,5 +175,5 @@
     printPositiveTestHeader(stdout, "psTime", "Convert tm time to psTime");
     psTime *timeN = NULL;
-    timeN = psTMToTime(tmTime);
+    timeN = psTimeFromTM(tmTime);
     printf("psTime: Seconds = %ld Microseconds = %d\n", (long)timeN->sec, (psU32)timeN->usec);
     psFree(timeN);
@@ -186,5 +186,5 @@
     char *testString2 = "2004-09-10T1:00:00.00Z";
     psTime* testTime2 = NULL;
-    testTime2 = psISOToTime(testString2);
+    testTime2 = psTimeFromISOTime(testString2);
     double dblTime = psTimeToLST(testTime2, 1);
     printf("LST (rad): %lf\n", dblTime);
Index: trunk/psLib/test/astronomy/tst_psTime_02.c
===================================================================
--- trunk/psLib/test/astronomy/tst_psTime_02.c	(revision 2041)
+++ trunk/psLib/test/astronomy/tst_psTime_02.c	(revision 2048)
@@ -9,6 +9,6 @@
  *  @author  Ross Harman, MHPCC
  *
- *  @version $Revision: 1.4 $  $Name: not supported by cvs2svn $
- *  @date  $Date: 2004-10-08 22:58:47 $
+ *  @version $Revision: 1.5 $  $Name: not supported by cvs2svn $
+ *  @date  $Date: 2004-10-12 01:34:09 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -24,10 +24,10 @@
     // Test A - Incorrect ISO time data
     printNegativeTestHeader(stdout,"psTime", "Incorrect ISO time data", "Time not allowed", 0);
-    psISOToTime("2004-99-21T18:22:24.272Z");
-    psISOToTime("2004-07-99T18:22:24.272Z");
-    psISOToTime("2004-07-21T99:22:24.272Z");
-    psISOToTime("2004-07-21T18:99:24.272Z");
-    psISOToTime("2004-07-21T18:22:99.272Z");
-    psISOToTime("2004-07-21T18:22:24.-999Z");
+    psTimeFromISOTime("2004-99-21T18:22:24.272Z");
+    psTimeFromISOTime("2004-07-99T18:22:24.272Z");
+    psTimeFromISOTime("2004-07-21T99:22:24.272Z");
+    psTimeFromISOTime("2004-07-21T18:99:24.272Z");
+    psTimeFromISOTime("2004-07-21T18:22:99.272Z");
+    psTimeFromISOTime("2004-07-21T18:22:24.-999Z");
     printFooter(stdout, "psTime", "Incorrect ISO time data", true);
 
@@ -36,5 +36,5 @@
     printNegativeTestHeader(stdout,"psTime", "Attempt to use null timeval",
                             "Null value for timeval arg not allowed", 0);
-    psTimevalToTime(NULL);
+    psTimeFromTimeval(NULL);
     printFooter(stdout, "psTime", "Attempt to use null timeval", true);
 
