Index: /trunk/psLib/test/astronomy/tst_psCoord.c
===================================================================
--- /trunk/psLib/test/astronomy/tst_psCoord.c	(revision 3323)
+++ /trunk/psLib/test/astronomy/tst_psCoord.c	(revision 3324)
@@ -6,6 +6,6 @@
 *  @author GLG, MHPCC
 *
-*  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2005-02-24 20:21:40 $
+*  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2005-02-25 02:47:53 $
 *
 *  XXX: Must test psSpherePrecess.
@@ -29,5 +29,5 @@
 static psS32 testSphereTransformApply1( void );
 static psS32 testSphereTransformApply2( void );
-static psS32 test5( void );
+static psS32 testSphereTransformICRSToEcliptic( void );
 static psS32 test6( void );
 static psS32 test7( void );
@@ -45,7 +45,7 @@
                               {test2, 0000, "psPlaneTransformApply()", 0, false},
                               {test3, 0000, "psPlaneDistortApply()", 0, false},
-                              {testSphereTransformApply1, 0000, "psPSphereTransformApply()", 0, false},
-                              {testSphereTransformApply2, 0000, "psPSphereTransformApply()", 0, false},
-                              {test5, 0000, "psSphereTransformICRSToEcliptic()", 0, false},
+                              {testSphereTransformApply1, 820, "psPSphereTransformApply()", 0, false},
+                              {testSphereTransformApply2, 820, "psPSphereTransformApply()", 0, false},
+                              {testSphereTransformICRSToEcliptic, 0000, "psSphereTransformICRSToEcliptic()", 0, false},
                               {test6, 0000, "psSphereTransformEclipticToICRS()", 0, false},
                               {test7, 0000, "psSphereTransformICRSToGalatic()", 0, false},
@@ -583,62 +583,105 @@
 }
 
-psS32 test5( void )
-{
-    psS32 testStatus = 0;
-
-    // XXX: This test code is simply a copy of the original source code.
-    psTime* now = psTimeGetTime(PS_TIME_UTC);
-    struct tm *tm_time = psTimeToTM(now);
-    psF64 MJD = psTimeToMJD(now);
-    struct tm *tmTime = psTimeToTM(now);
-    psF64 year = (psF64)(1900 - MJD + tmTime->tm_year);
-    psF64 T = year / 100.0;
-    psF64 expectedAlphaP = 0.0;
-    psF64 expectedDeltaP = DEG_TO_RAD(23.0) +
-                           SEC_TO_RAD(27.0) +
-                           MIN_TO_RAD(8.0) -
-                           (SEC_TO_RAD(46.845) * T) -
-                           (SEC_TO_RAD(0.0059) * T * T) +
-                           (SEC_TO_RAD(0.00181) * T * T * T);
-    expectedDeltaP*= -1.0;
-    psF64 expectedPhiP = 0.0;
-    psFree(tmTime);
-
-    psSphereTransform *myST = psSphereTransformICRSToEcliptic(now);
-
-    if (FLT_EPSILON < fabs(sin(expectedDeltaP) - myST->sinDeltaP)) {
-        printf("ERROR: myST->sinDeltaP is %f, should be %f\n", myST->sinDeltaP, sin(expectedDeltaP));
-        testStatus = 1;
-    }
-
-    if (FLT_EPSILON < fabs(cos(expectedDeltaP) - myST->cosDeltaP)) {
-        printf("ERROR: myST->cosDeltaP is %f, should be %f\n", myST->cosDeltaP, cos(expectedDeltaP));
-        testStatus = 1;
-    }
-
-    if (FLT_EPSILON < fabs(expectedAlphaP - myST->alphaP)) {
-        printf("ERROR: myST->alphaP is %f, should be %f\n", myST->alphaP, expectedAlphaP);
-        testStatus = 3;
-    }
-
-    if (FLT_EPSILON < fabs(expectedPhiP - myST->phiP)) {
-        printf("ERROR: myST->phiP is %f, should be %f\n", myST->phiP, expectedPhiP);
-        testStatus = 4;
-    }
-
+#define MJD_1900  15021.0        // Modified Julian Day 1/1/1900 00:00:00
+#define MJD_2000  51544.0        // Modified Julian Day 1/1/2000 00:00:00
+#define MJD_2100  88069.0        // Modified Julian Day 1/1/2100 00:00:00
+
+// Thes values calculated from ADD-09 equations
+#define EXPECT_COS_DELTAP_2000    0.917482
+#define EXPECT_SIN_DELTAP_2000   -0.397777
+#define EXPECT_COS_DELTAP_2100    0.917572
+#define EXPECT_SIN_DELTAP_2100   -0.397567
+
+#define ERROR_TOL   0.0001
+
+psS32 testSphereTransformICRSToEcliptic( void )
+{
+    psF64  expectedPhiP = 0.0;
+    psF64  expectedAlphaP = 0.0;
+    psF64  expectedCosDeltaP = EXPECT_COS_DELTAP_2000;
+    psF64  expectedSinDeltaP = EXPECT_SIN_DELTAP_2000;
+
+    // Set test date time to 1/1/2000 00:00:00
+    psTime* testDateTime = psTimeFromMJD(MJD_2000);
+
+    // Invoke function to set psSphereTransforma objec
+    psSphereTransform *myST = psSphereTransformICRSToEcliptic(testDateTime);
+
+    // Verify expected values for the specified time
+    if (ERROR_TOL < fabs(expectedSinDeltaP - myST->sinDeltaP)) {
+        psError(PS_ERR_UNKNOWN,true,"myST->sinDeltaP is %f, should be %f",
+                myST->sinDeltaP, expectedSinDeltaP);
+        return 1;
+    }
+    if (ERROR_TOL < fabs(expectedCosDeltaP - myST->cosDeltaP)) {
+        psError(PS_ERR_UNKNOWN,true,"myST->cosDeltaP is %f, should be %f",
+                myST->cosDeltaP, expectedCosDeltaP);
+        return 2;
+    }
+    if (ERROR_TOL < fabs(expectedAlphaP - myST->alphaP)) {
+        psError(PS_ERR_UNKNOWN,true,"myST->alphaP is %f, should be %f",
+                myST->alphaP, expectedAlphaP);
+        return 3;
+    }
+    if (ERROR_TOL < fabs(expectedPhiP - myST->phiP)) {
+        psError(PS_ERR_UNKNOWN,true,"myST->phiP is %f, should be %f",
+                myST->phiP, expectedPhiP);
+        return 4;
+    }
     psFree(myST);
-    psFree(tm_time);
-    psFree(now);
-
-    printf("-------------------------------------------------------------------\n");
-    printf("Calling psSphereTransformICRSToEcliptic() with NULL input.  Should generate error, return NULL.\n");
+    psFree(testDateTime);
+
+    expectedCosDeltaP = EXPECT_COS_DELTAP_2100;
+    expectedSinDeltaP = EXPECT_SIN_DELTAP_2100;
+
+    // Set test date time to 1/1/2100 00:00:00
+    testDateTime = psTimeFromMJD(MJD_2100);
+
+    // Invoke function to set psSphereTransforma objec
+    myST = psSphereTransformICRSToEcliptic(testDateTime);
+
+    // Verify expected values for the specified time
+    if (ERROR_TOL < fabs(expectedSinDeltaP - myST->sinDeltaP)) {
+        psError(PS_ERR_UNKNOWN,true,"myST->sinDeltaP is %f, should be %f",
+                myST->sinDeltaP, expectedSinDeltaP);
+        return 5;
+    }
+    if (ERROR_TOL < fabs(expectedCosDeltaP - myST->cosDeltaP)) {
+        psError(PS_ERR_UNKNOWN,true,"myST->cosDeltaP is %f, should be %f",
+                myST->cosDeltaP, expectedCosDeltaP);
+        return 6;
+    }
+    if (ERROR_TOL < fabs(expectedAlphaP - myST->alphaP)) {
+        psError(PS_ERR_UNKNOWN,true,"myST->alphaP is %f, should be %f",
+                myST->alphaP, expectedAlphaP);
+        return 7;
+    }
+    if (ERROR_TOL < fabs(expectedPhiP - myST->phiP)) {
+        psError(PS_ERR_UNKNOWN,true,"myST->phiP is %f, should be %f",
+                myST->phiP, expectedPhiP);
+        return 8;
+    }
+    psFree(myST);
+    psFree(testDateTime);
+
+    // Verify if argument psTime is NULL, function returns NULL and error message generated
+    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message");
     myST = psSphereTransformICRSToEcliptic(NULL);
     if (myST != NULL) {
-        printf("TEST ERROR: psSphereTransformApply() did not return NULL.\n");
-        testStatus = false;
-        myST = NULL;
-    }
-
-    return(testStatus);
+        psError(PS_ERR_UNKNOWN,true,"psSphereTransformICRSToEcliptic() did not return NULL.");
+        return 9;
+    }
+
+    // Verify if argument psTime is less than 1900, function return NULL and error msg generated
+    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message");
+    testDateTime = psTimeFromMJD(MJD_1900 - 1.0);
+    myST = psSphereTransformICRSToEcliptic(testDateTime);
+    if (myST != NULL) {
+        psError(PS_ERR_UNKNOWN,true,"psSphereTransformICRSToEcliptic() did not return NULL.");
+        return 10;
+    }
+    psFree(testDateTime);
+
+    return 0;
 }
 
Index: /trunk/psLib/test/astronomy/verified/tst_psCoord.stderr
===================================================================
--- /trunk/psLib/test/astronomy/verified/tst_psCoord.stderr	(revision 3323)
+++ /trunk/psLib/test/astronomy/verified/tst_psCoord.stderr	(revision 3324)
@@ -104,6 +104,12 @@
 \**********************************************************************************/
 
+<DATE><TIME>|<HOST>|I|testSphereTransformICRSToEcliptic
+    Following should generate an error message
 <DATE><TIME>|<HOST>|E|psSphereTransformICRSToEcliptic (FILE:LINENO)
     Unallowable operation: time is NULL.
+<DATE><TIME>|<HOST>|I|testSphereTransformICRSToEcliptic
+    Following should generate an error message
+<DATE><TIME>|<HOST>|E|psSphereTransformICRSToEcliptic (FILE:LINENO)
+    Specified time is less than 1900.
 
 ---> TESTPOINT PASSED (psCoord{psSphereTransformICRSToEcliptic()} | tst_psCoord.c)
Index: /trunk/psLib/test/astronomy/verified/tst_psCoord.stdout
===================================================================
--- /trunk/psLib/test/astronomy/verified/tst_psCoord.stdout	(revision 3323)
+++ /trunk/psLib/test/astronomy/verified/tst_psCoord.stdout	(revision 3324)
@@ -32,6 +32,4 @@
 -------------------------------------------------------------------
 -------------------------------------------------------------------
-Calling psSphereTransformICRSToEcliptic() with NULL input.  Should generate error, return NULL.
--------------------------------------------------------------------
 Calling psSphereTransformEclipticToICRS() with NULL input.  Should generate error, return NULL.
 -------------------------------------------------------------------
