Index: trunk/psLib/test/astro/tst_psEarthOrientation.c
===================================================================
--- trunk/psLib/test/astro/tst_psEarthOrientation.c	(revision 6030)
+++ trunk/psLib/test/astro/tst_psEarthOrientation.c	(revision 6039)
@@ -5,6 +5,6 @@
 *  @author d-Rob, MHPCC
 *
-*  @version $Revision: 1.26 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2006-01-18 00:41:29 $
+*  @version $Revision: 1.27 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2006-01-18 23:49:06 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -25,4 +25,5 @@
 static psS32 testSphereRot_CEOtoGCRS(void);
 static psS32 testSphereRot_ITRStoTEO(void);
+static psS32 testSphereRotPrecess(void);
 
 testDescription tests[] = {
@@ -37,4 +38,5 @@
                               {testSphereRot_CEOtoGCRS, 675, "psSphereRot_CEOtoGCRS()", 0, false},
                               {testSphereRot_ITRStoTEO, 676, "psSphereRRot_ITRStoTEO()", 0, false},
+                              {testSphereRotPrecess, 677, "psSphereRotPrecess()", 0, false},
                               {NULL}
                           };
@@ -661,12 +663,13 @@
     }
     //Return NULL for UT1 time input
-    psTime *UT1time = psTimeAlloc(PS_TIME_UT1);
-    nute = psEOC_NutationCorr(UT1time);
-    if (nute != NULL) {
-        psError(PS_ERR_BAD_PARAMETER_VALUE, false,
-                "psEOC_NutationCorr failed to return NULL for UT1 input time.\n");
-        return 2;
-    }
-    psFree(UT1time);
+    /*    psTime *UT1time = psTimeAlloc(PS_TIME_UT1);
+        nute = psEOC_NutationCorr(UT1time);
+        if (nute != NULL) {
+            psError(PS_ERR_BAD_PARAMETER_VALUE, false,
+                    "psEOC_NutationCorr failed to return NULL for UT1 input time.\n");
+            return 2;
+        }
+        psFree(UT1time);
+    */
     //Check return values from valid nutation time input
     nute = psEOC_NutationCorr(in);
@@ -925,2 +928,135 @@
 }
 
+#define SPHERE_PRECESS_TP1_R            0.0               //    0.0       degrees
+#define SPHERE_PRECESS_TP1_D            0.0               //    0.0       degrees
+#define SPHERE_PRECESS_TP1_EXPECT_R     6.238453          //  357.437     degrees
+#define SPHERE_PRECESS_TP1_EXPECT_D    -0.019426          //   -1.113     degrees
+#define SPHERE_PRECESS_TP2_R            0.0               //    0.0       degrees
+#define SPHERE_PRECESS_TP2_D            1.570796          //   90.0       degrees
+#define SPHERE_PRECESS_TP2_EXPECT_R     6.260828          //  358.719     degrees
+#define SPHERE_PRECESS_TP2_EXPECT_D     1.551353          //   88.886     degrees
+#define SPHERE_PRECESS_TP3_R            3.141593          //  180.0       degrees
+#define SPHERE_PRECESS_TP3_D            0.523599          //   30.0       degrees
+#define SPHERE_PRECESS_TP3_EXPECT_R     3.096616          //  177.423     degrees
+#define SPHERE_PRECESS_TP3_EXPECT_D     0.543024          //   31.113     degrees
+#define ERROR_TOL   0.0001
+#define MJD_1900  15021.0        // Modified Julian Day 1/1/1900 00:00:00
+#define MJD_2100  88069.0        // Modified Julian Day 1/1/2100 00:00:00
+
+psS32 testSphereRotPrecess( void )
+{
+
+    psSphere*     inputCoord  = psSphereAlloc();
+    psSphere*     outputCoord = NULL;
+    psTime*       fromTime    = psTimeFromMJD(MJD_2100);
+    psTime*       toTime      = psTimeFromMJD(MJD_1900);
+
+    // Set input coordinate
+    inputCoord->r = SPHERE_PRECESS_TP1_R;
+    inputCoord->d = SPHERE_PRECESS_TP1_D;
+    inputCoord->rErr = 0.0;
+    inputCoord->dErr = 0.0;
+
+    // Calculate precess
+    outputCoord = psSpherePrecess(inputCoord, fromTime, toTime);
+    // Verify return is not NULL
+    if(outputCoord == NULL) {
+        psError(PS_ERR_UNKNOWN,true,"Returned NULL not expected");
+        return 1;
+    }
+    // Verify return with expected values
+    if( fabs(outputCoord->r - SPHERE_PRECESS_TP1_EXPECT_R) > ERROR_TOL) {
+        psError(PS_ERR_UNKNOWN,true,"Precess r = %lg not equal to expected = %lg",
+                outputCoord->r,SPHERE_PRECESS_TP1_EXPECT_R);
+        return 2;
+    }
+    if( fabs(outputCoord->d - SPHERE_PRECESS_TP1_EXPECT_D) > ERROR_TOL) {
+        psError(PS_ERR_UNKNOWN,true,"Precess d = %lg not equal to expected = %lg",
+                outputCoord->d,SPHERE_PRECESS_TP1_EXPECT_D);
+        return 3;
+    }
+    psFree(outputCoord);
+
+    // Set input coordinate
+    inputCoord->r = SPHERE_PRECESS_TP2_R;
+    inputCoord->d = SPHERE_PRECESS_TP2_D;
+    inputCoord->rErr = 0.0;
+    inputCoord->dErr = 0.0;
+
+    // Calculate precess
+    outputCoord = psSpherePrecess(inputCoord, fromTime, toTime);
+    // Verify return is not NULL
+    if(outputCoord == NULL) {
+        psError(PS_ERR_UNKNOWN,true,"Returned NULL not expected");
+        return 4;
+    }
+    // Verify return with expected values
+    if( fabs(outputCoord->r - SPHERE_PRECESS_TP2_EXPECT_R) > ERROR_TOL) {
+        psError(PS_ERR_UNKNOWN,true,"Precess r = %lg not equal to expected = %lg",
+                outputCoord->r,SPHERE_PRECESS_TP2_EXPECT_R);
+        return 5;
+    }
+    if( fabs(outputCoord->d - SPHERE_PRECESS_TP2_EXPECT_D) > ERROR_TOL) {
+        psError(PS_ERR_UNKNOWN,true,"Precess d = %lg not equal to expected = %lg",
+                outputCoord->d,SPHERE_PRECESS_TP2_EXPECT_D);
+        return 6;
+    }
+    psFree(outputCoord);
+
+    // Set input coordinate
+    inputCoord->r = SPHERE_PRECESS_TP3_R;
+    inputCoord->d = SPHERE_PRECESS_TP3_D;
+    inputCoord->rErr = 0.0;
+    inputCoord->dErr = 0.0;
+
+    // Calculate precess
+    outputCoord = psSpherePrecess(inputCoord, fromTime, toTime);
+    // Verify return is not NULL
+    if(outputCoord == NULL) {
+        psError(PS_ERR_UNKNOWN,true,"Returned NULL not expected");
+        return 7;
+    }
+    // Verify return with expected values
+    if( fabs(outputCoord->r - SPHERE_PRECESS_TP3_EXPECT_R) > ERROR_TOL) {
+        psError(PS_ERR_UNKNOWN,true,"Precess r = %lg not equal to expected = %lg",
+                outputCoord->r,SPHERE_PRECESS_TP3_EXPECT_R);
+        return 8;
+    }
+    if( fabs(outputCoord->d - SPHERE_PRECESS_TP3_EXPECT_D) > ERROR_TOL) {
+        psError(PS_ERR_UNKNOWN,true,"Precess d = %lg not equal to expected = %lg",
+                outputCoord->d,SPHERE_PRECESS_TP3_EXPECT_D);
+        return 9;
+    }
+    psFree(outputCoord);
+
+    // Invoke precess with invalid parameter
+    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message");
+    outputCoord = psSpherePrecess(inputCoord, fromTime, NULL);
+    if(outputCoord != NULL) {
+        psError(PS_ERR_UNKNOWN,true,"Did not return NULL with invalid input");
+        return 10;
+    }
+
+    // Invoke precess with invalid parameter
+    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message");
+    outputCoord = psSpherePrecess(inputCoord, NULL, toTime);
+    if(outputCoord != NULL) {
+        psError(PS_ERR_UNKNOWN,true,"Did not return NULL with invalid input");
+        return 11;
+    }
+
+    // Invoke precess with invalid parameter
+    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message");
+    outputCoord = psSpherePrecess(NULL, fromTime, toTime);
+    if(outputCoord != NULL) {
+        psError(PS_ERR_UNKNOWN,true,"Did not return NULL with invalid input");
+        return 12;
+    }
+
+    // Free objects
+    psFree(fromTime);
+    psFree(toTime);
+    psFree(inputCoord);
+
+    return 0;
+}
