Index: /trunk/psLib/test/astronomy/tst_psCoord.c
===================================================================
--- /trunk/psLib/test/astronomy/tst_psCoord.c	(revision 3292)
+++ /trunk/psLib/test/astronomy/tst_psCoord.c	(revision 3293)
@@ -6,6 +6,6 @@
 *  @author GLG, MHPCC
 *
-*  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2005-02-17 19:26:24 $
+*  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2005-02-19 02:55:33 $
 *
 *  XXX: Must test psSpherePrecess.
@@ -22,10 +22,10 @@
 #include "psTest.h"
 #include "pslib.h"
-static psS32 test1( void );
+static psS32 testSphereTransformAlloc( void );
 static psS32 test1b( void );
 static psS32 test1c( void );
 static psS32 test2( void );
 static psS32 test3( void );
-static psS32 test4( void );
+static psS32 testSphereTransformApply1( void );
 static psS32 test4b( void );
 static psS32 test5( void );
@@ -40,10 +40,10 @@
 //static psS32 test43( void );
 testDescription tests[] = {
-                              {test1, 0000, "psSphereTransformAlloc()", 0, false},
+                              {testSphereTransformAlloc, 819, "psSphereTransformAlloc()", 0, false},
                               {test1b, 0000, "psPlaneTransformAlloc()", 0, false},
                               {test1c, 0000, "psPlaneDistortAlloc()", 0, false},
                               {test2, 0000, "psPlaneTransformApply()", 0, false},
                               {test3, 0000, "psPlaneDistortApply()", 0, false},
-                              {test4, 0000, "psPSphereTransformApply()", 0, false},
+                              {testSphereTransformApply1, 0000, "psPSphereTransformApply()", 0, false},
                               {test4b, 0000, "psPSphereTransformApply()", 0, false},
                               {test5, 0000, "psSphereTransformICRSToEcliptic()", 0, false},
@@ -90,32 +90,39 @@
 #define DELTA_P 2.0
 #define PHI_P 3.0
-psS32 test1( void )
-{
-    psS32 testStatus = 0;
+psS32 testSphereTransformAlloc( void )
+{
+    // Allocate data structure
     psSphereTransform *myST = psSphereTransformAlloc(ALPHA_P, DELTA_P, PHI_P);
-
+    // Verify null not returned
+    if(myST == NULL) {
+        psError(PS_ERR_UNKNOWN,true,"Returned NULL with valid parameters");
+        return 1;
+    }
+    // Verify sin member is updated
     psF32 sinDeltaP = sin(DELTA_P);
     if (FLT_EPSILON < fabs(sinDeltaP - myST->sinDeltaP)) {
-        printf("ERROR: myST->sinDeltaP is %f, should be %f\n", myST->sinDeltaP, sinDeltaP);
-        testStatus = 1;
-    }
+        psError(PS_ERR_UNKNOWN,true,"myST->sinDeltaP is %f, should be %f\n", myST->sinDeltaP, sinDeltaP);
+        return 2;
+    }
+    // Verify cos member is update
     psF32 cosDeltaP = cos(DELTA_P);
     if (FLT_EPSILON < fabs(cosDeltaP - myST->cosDeltaP)) {
-        printf("ERROR: myST->cosDeltaP is %f, should be %f\n", myST->cosDeltaP, cosDeltaP);
-        testStatus = 1;
-    }
-
+        psError(PS_ERR_UNKNOWN,true,"myST->cosDeltaP is %f, should be %f\n", myST->cosDeltaP, cosDeltaP);
+        return 3;
+    }
+    // Verify alpha is updated
     if (FLT_EPSILON < fabs(ALPHA_P - myST->alphaP)) {
-        printf("ERROR: myST->alphaP is %f, should be %f\n", myST->alphaP, ALPHA_P);
-        testStatus = 3;
-    }
-
+        psError(PS_ERR_UNKNOWN,true,"myST->alphaP is %f, should be %f\n", myST->alphaP, ALPHA_P);
+        return 4;
+    }
+    // Verify phi is updated
     if (FLT_EPSILON < fabs(PHI_P - myST->phiP)) {
-        printf("ERROR: myST->phiP is %f, should be %f\n", myST->phiP, PHI_P);
-        testStatus = 4;
-    }
-
+        psError(PS_ERR_UNKNOWN,true,"myST->phiP is %f, should be %f\n", myST->phiP, PHI_P);
+        return 5;
+    }
+    // Free data structure
     psFree(myST);
-    return(testStatus);
+
+    return 0;
 }
 
@@ -430,34 +437,35 @@
 #define DEG_INC 30.0
 // We do a simple identity transformation on a few RA, DEC pairs.
-psS32 test4( void )
-{
-    psS32 testStatus = 0;
-    psSphere in;
-    psSphere out;
+psS32 testSphereTransformApply1( void )
+{
+    psSphere *in = psSphereAlloc();
+    psSphere *out = psSphereAlloc();
+    psSphere *temp = NULL;
     psSphere *rc = NULL;
     psSphereTransform *myST = psSphereTransformAlloc(0.0, 0.0, 0.0);
 
-    in.r = DEG_TO_RAD(45.0);
-    in.d = DEG_TO_RAD(30.0);
-    in.rErr = 0.0;
-    in.dErr = 0.0;
+    in->r = DEG_TO_RAD(45.0);
+    in->d = DEG_TO_RAD(30.0);
+    in->rErr = 0.0;
+    in->dErr = 0.0;
 
     for (float r=0.0;r<180.0;r+=DEG_INC) {
         for (float d=0.0;d<90.0;d+=DEG_INC) {
-            in.r = DEG_TO_RAD(r);
-            in.d = DEG_TO_RAD(d);
-            in.rErr = 0.0;
-            in.dErr = 0.0;
-
-            psSphereTransformApply(&out, myST, &in);
-
-            if (FLT_EPSILON < fabs(out.r - in.r)) {
-                printf("ERROR: out.r is %f, should be %f\n", out.r, in.r);
-                testStatus = 4;
+            in->r = DEG_TO_RAD(r);
+            in->d = DEG_TO_RAD(d);
+            in->rErr = 0.0;
+            in->dErr = 0.0;
+
+            if(psSphereTransformApply(out, myST, in) != out) {
+                psError(PS_ERR_UNKNOWN,true,"Did not return output pointer.");
+                return 1;
             }
-
-            if (FLT_EPSILON < fabs(out.d - in.d)) {
-                printf("ERROR: out.d is %f, should be %f\n", out.d, in.d);
-                testStatus = 5;
+            if (FLT_EPSILON < fabs(out->r - in->r)) {
+                psError(PS_ERR_UNKNOWN,true,"out->r is %f, should be %f\n", out->r, in->r);
+                return 2;
+            }
+            if (FLT_EPSILON < fabs(out->d - in->d)) {
+                psError(PS_ERR_UNKNOWN,true,"out->d is %f, should be %f\n", out->d, in->d);
+                return 3;
             }
             // printf("psSphereTransformApply (%f, %f) -> (%f, %f)\n", out.r, out.d, in.r, in.d);
@@ -465,25 +473,33 @@
     }
 
-    printf("-------------------------------------------------------------------\n");
-    printf("Calling psSphereTransformApply() with NULL psSphereTransform.  Should generate error, return NULL.\n");
-    rc = psSphereTransformApply(NULL, NULL, &in);
+    // Verify new sphere object is created if out parameter NULL
+    temp = psSphereTransformApply(NULL, myST, in);
+    if ( temp == NULL) {
+        psError(PS_ERR_UNKNOWN,true,"Returned NULL when out parameter was null");
+        return 4;
+    }
+    psFree(temp);
+
+    // Verify NULL returned if transform structure null
+    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error");
+    rc = psSphereTransformApply(NULL, NULL, in);
     if (rc != NULL) {
-        printf("TEST ERROR: psSphereTransformApply() did not return NULL.\n");
-        testStatus = false;
-        rc = NULL;
-    }
-
-    printf("-------------------------------------------------------------------\n");
-    printf("Calling psSphereTransformApply() with NULL input coords.  Should generate error, return NULL.\n");
+        psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply() did not return NULL.");
+        return 5;
+    }
+
+    // Verify NULL returned when input sphere is NULL
+    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error");
     rc = psSphereTransformApply(NULL, myST, NULL);
     if (rc != NULL) {
-        printf("TEST ERROR: psSphereTransformApply() did not return NULL.\n");
-        testStatus = false;
-        rc = NULL;
-    }
-
-    printf("-------------------------------------------------------------------\n");
+        psError(PS_ERR_UNKNOWN,true,"psSphereTransformApply() did not return NULL");
+        return 6;
+    }
+
     psFree(myST);
-    return(testStatus);
+    psFree(out);
+    psFree(in);
+
+    return 0;
 }
 
Index: /trunk/psLib/test/astronomy/verified/tst_psCoord.stderr
===================================================================
--- /trunk/psLib/test/astronomy/verified/tst_psCoord.stderr	(revision 3292)
+++ /trunk/psLib/test/astronomy/verified/tst_psCoord.stderr	(revision 3293)
@@ -78,6 +78,10 @@
 \**********************************************************************************/
 
+<DATE><TIME>|<HOST>|I|testSphereTransformApply1
+    Following should generate an error
 <DATE><TIME>|<HOST>|E|psSphereTransformApply (FILE:LINENO)
     Unallowable operation: transform is NULL.
+<DATE><TIME>|<HOST>|I|testSphereTransformApply1
+    Following should generate an error
 <DATE><TIME>|<HOST>|E|psSphereTransformApply (FILE:LINENO)
     Unallowable operation: coord is NULL.
Index: /trunk/psLib/test/astronomy/verified/tst_psCoord.stdout
===================================================================
--- /trunk/psLib/test/astronomy/verified/tst_psCoord.stdout	(revision 3292)
+++ /trunk/psLib/test/astronomy/verified/tst_psCoord.stdout	(revision 3293)
@@ -32,9 +32,4 @@
 -------------------------------------------------------------------
 -------------------------------------------------------------------
-Calling psSphereTransformApply() with NULL psSphereTransform.  Should generate error, return NULL.
--------------------------------------------------------------------
-Calling psSphereTransformApply() with NULL input coords.  Should generate error, return NULL.
--------------------------------------------------------------------
--------------------------------------------------------------------
 Calling psSphereTransformICRSToEcliptic() with NULL input.  Should generate error, return NULL.
 -------------------------------------------------------------------
