Index: trunk/psLib/test/astro/tst_psEarthOrientation.c
===================================================================
--- trunk/psLib/test/astro/tst_psEarthOrientation.c	(revision 6184)
+++ trunk/psLib/test/astro/tst_psEarthOrientation.c	(revision 6189)
@@ -5,6 +5,6 @@
 *  @author d-Rob, MHPCC
 *
-*  @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2006-01-23 20:04:31 $
+*  @version $Revision: 1.29 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2006-01-25 03:02:47 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -305,4 +305,5 @@
     psEarthPole *pmodel = NULL;
     //Return NULL for NULL time input
+    psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message");
     pmodel = psEOC_PrecessionModel(empty);
     if (pmodel != NULL) {
@@ -312,4 +313,5 @@
     }
     //Return NULL for UT1 time input
+    psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message");
     psTime *UT1time = psTimeAlloc(PS_TIME_UT1);
     pmodel = psEOC_PrecessionModel(UT1time);
@@ -361,10 +363,10 @@
     time2->nsec = 0;
     time2->leapsecond = false;
-
-    //XXX:  MAY Be an Error here... Time for Precession Correction has to be TAI or seg faults
-    time2 = psTimeConvert(time2, PS_TIME_TAI);
+    //    time2 = psTimeConvert(time2, PS_TIME_TAI);
+
     //Tests for Precession Correction function//
     //Return NULL for NULL time input
     psEarthPole *pcorr = NULL;
+    psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message");
     pcorr = psEOC_PrecessionCorr(empty, PS_IERS_A);
     if (pcorr != NULL) {
@@ -375,4 +377,5 @@
 
     //Return NULL for Invalid IERS table
+    psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message");
     pcorr = psEOC_PrecessionCorr(time2, 3);
     if (pcorr != NULL) {
@@ -522,4 +525,5 @@
 
     //Return NULL for NULL input time
+    psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message");
     polarMotion = psEOC_GetPolarMotion(empty, PS_IERS_B);
     if (polarMotion != NULL) {
@@ -529,4 +533,5 @@
     }
     //Return NULL for incorrect Bulletin.
+    psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message");
     polarMotion = psEOC_GetPolarMotion(empty, 3);
     if (polarMotion != NULL) {
@@ -625,4 +630,6 @@
     psEarthPole *eop = NULL;
 
+    //Return NULL for NULL input time
+    psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message");
     eop = psEOC_PolarTideCorr(empty);
     if (eop != NULL) {
@@ -658,4 +665,5 @@
 
     //Return NULL for NULL input time.
+    psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message");
     nute = psEOC_NutationCorr(empty);
     if (nute != NULL) {
@@ -705,4 +713,5 @@
 
     //return NULL for NULL input time
+    psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message");
     rot = psSphereRot_TEOtoCEO(empty, NULL);
     if (rot != NULL) {
@@ -783,4 +792,6 @@
     q3 = -0.9999999897238481;
 
+    //Return NULL for NULL input earthpole
+    psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message");
     rot = psSphereRot_CEOtoGCRS(empty);
     if (rot != NULL) {
@@ -793,5 +804,5 @@
     if (rot == NULL) {
         psError(PS_ERR_BAD_PARAMETER_NULL, false,
-                "psSphereRot_CEOtoGCRS return NULL for valid psEarthPole input.\n");
+                "psSphereRot_CEOtoGCRS returned NULL for valid psEarthPole input.\n");
         return 2;
     }
@@ -857,4 +868,6 @@
     in->s = SEC_TO_RAD(in->s);
 
+    //Return NULL for NULL input earthpole
+    psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message");
     rot = psSphereRot_ITRStoTEO(empty);
     if (rot != NULL) {
@@ -863,4 +876,5 @@
         return 1;
     }
+
     rot = psSphereRot_ITRStoTEO(in);
     if (rot == NULL) {
@@ -1050,32 +1064,69 @@
     psFree(rot);
 
-    // 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;
-        }
-    */
+    //Test other modes (IAU2000A, COMPLETE_[A,B])
+    // 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
+    rot = psSpherePrecess(fromTime, toTime, PS_PRECESS_COMPLETE_A);
+    outputCoord = psSphereRotApply(NULL, rot, inputCoord);
+    if (outputCoord->r < -0.000001) {
+        outputCoord->r += 2.0 * M_PI;
+    }
+    // Verify return is not NULL
+    if(outputCoord == NULL) {
+        psError(PS_ERR_UNKNOWN,true,"Returned NULL not expected");
+        return 10;
+    }
+    psFree(outputCoord);
+    psFree(rot);
+
+    rot = psSpherePrecess(fromTime, toTime, PS_PRECESS_COMPLETE_B);
+    outputCoord = psSphereRotApply(NULL, rot, inputCoord);
+    if (outputCoord->r < -0.000001) {
+        outputCoord->r += 2.0 * M_PI;
+    }
+    // Verify return is not NULL
+    if(outputCoord == NULL) {
+        psError(PS_ERR_UNKNOWN,true,"Returned NULL not expected");
+        return 11;
+    }
+    psFree(outputCoord);
+    psFree(rot);
+
+    rot = psSpherePrecess(fromTime, toTime, PS_PRECESS_IAU2000A);
+    outputCoord = psSphereRotApply(NULL, rot, inputCoord);
+    if (outputCoord->r < -0.000001) {
+        outputCoord->r += 2.0 * M_PI;
+    }
+    // Verify return is not NULL
+    if(outputCoord == NULL) {
+        psError(PS_ERR_UNKNOWN,true,"Returned NULL not expected");
+        return 12;
+    }
+    psFree(outputCoord);
+    psFree(rot);
+
     // Invoke precess with invalid parameter
     psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message");
     rot = psSpherePrecess(fromTime, toTime, 10);
-    //    outputCoord = psSpherePrecess(NULL, fromTime, toTime, PS_PRECESS_ROUGH);
     if(rot != NULL) {
-        //    if(outputCoord != NULL) {
         psError(PS_ERR_UNKNOWN,true,"Did not return NULL with invalid input");
+        return 14;
+    }
+    // Return NULL for NULL input times
+    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message");
+    rot = psSpherePrecess(NULL, NULL, PS_PRECESS_ROUGH);
+    if(rot != NULL) {
+        psError(PS_ERR_UNKNOWN,true,"Did not return NULL with invalid input");
+        return 15;
+    }
+
+    if (!p_psEOCFinalize() ) {
+        psError(PS_ERR_BAD_PARAMETER_VALUE, false, "EOC failed finalization!\n");
         return 12;
     }
-    psFree(rot);
-
     // Free objects
     psFree(fromTime);
