Index: /trunk/psLib/test/astronomy/tst_psCoord.c
===================================================================
--- /trunk/psLib/test/astronomy/tst_psCoord.c	(revision 3430)
+++ /trunk/psLib/test/astronomy/tst_psCoord.c	(revision 3431)
@@ -6,6 +6,6 @@
 *  @author GLG, MHPCC
 *
-*  @version $Revision: 1.23 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2005-03-02 23:00:17 $
+*  @version $Revision: 1.24 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2005-03-16 02:31:05 $
 *
 *  XXX: THe psProject() and psDeproject() functions do not work fully.  They
@@ -24,5 +24,5 @@
 static psS32 testPlaneTransformAlloc( void );
 static psS32 testPlaneDistortAlloc( void );
-static psS32 test2( void );
+static psS32 testPlaneTransformApply( void );
 static psS32 test3( void );
 static psS32 testSphereTransformApply1( void );
@@ -46,5 +46,5 @@
                               {testPlaneTransformAlloc, 826, "psPlaneTransformAlloc()", 0, false},
                               {testPlaneDistortAlloc, 827, "psPlaneDistortAlloc()", 0, false},
-                              {test2, 0000, "psPlaneTransformApply()", 0, false},
+                              {testPlaneTransformApply, 0000, "psPlaneTransformApply()", 0, false},
                               {test3, 0000, "psPlaneDistortApply()", 0, false},
                               {testSphereTransformApply1, 820, "psSphereTransformApply()", 0, false},
@@ -294,83 +294,91 @@
 #define N 10
 // We do a simple identity transformation on a few x,y pairs.
-psS32 test2( void )
-{
-    psS32 i;
-    psS32 testStatus = 0;
-    psPlane in;
-    psPlane out;
-    psPlane *rc;
-    psPlaneTransform pt;
-    psDPolynomial2D *tmp2DPoly = NULL;
-
-    pt.x = psDPolynomial2DAlloc(2, 2, PS_POLYNOMIAL_ORD);
-    pt.y = psDPolynomial2DAlloc(2, 2, PS_POLYNOMIAL_ORD);
-    pt.x->coeff[1][0] = 1.0;
-    pt.y->coeff[0][1] = 1.0;
-    for (i=0;i<N;i++) {
-        in.x = (float) i;
-        in.y = (float) (i + 5.0);
-        in.xErr = 0.0;
-        in.yErr = 0.0;
-        psPlaneTransformApply(&out, &pt, &in);
-
-        if (FLT_EPSILON < fabs(out.x - in.x)) {
-            printf("ERROR: out.x is %f, should be %f\n", out.x, in.x);
-            testStatus = 3;
+psS32 testPlaneTransformApply( void )
+{
+    psPlane*          out = NULL;
+    psDPolynomial2D*  tmp2DPoly = NULL;
+    psPlane*          rc;
+
+    // Create input coordinate
+    psPlane* in = psPlaneAlloc();
+    if(in == NULL) {
+        psError(PS_ERR_UNKNOWN,true,"Did not expect NULL return from psPlaneAlloc");
+        return 1;
+    }
+
+    // Create transform
+    psPlaneTransform* pt = psPlaneTransformAlloc(2,2);
+
+    // Set transform coefficients so the x coord input will equal x coord output, same for y
+    pt->x->coeff[1][0] = 1.0;
+    pt->y->coeff[0][1] = 1.0;
+
+    // Apply transform for several points
+    for (psS32 i = 0; i < N; i++) {
+        in->x = (psF64) i;
+        in->y = (psF64) (i + 5.0);
+        in->xErr = 0.0;
+        in->yErr = 0.0;
+
+        // Verify function does not return NULL
+        out = psPlaneTransformApply(out, pt, in);
+        if( out  == NULL) {
+            psError(PS_ERR_UNKNOWN,true,"Expected non-NULL return value");
+            return 1;
         }
-
-        if (FLT_EPSILON < fabs(out.y - in.y)) {
-            printf("ERROR: out.y is %f, should be %f\n", out.y, in.y);
-            testStatus = 4;
+        // Verify the expected values are returned
+        if (FLT_EPSILON < fabs(out->x - in->x)) {
+            psError(PS_ERR_UNKNOWN,true,"out.x is %lf, should be %lf", out->x, in->x);
+            return 3;
         }
-        //printf("psPlaneTransformApply(): (%f, %f) -> (%f, %f)\n", in.x, in.y, out.x, out.y);
-    }
-
-    printf("-------------------------------------------------------------------\n");
-    printf("Calling psPlaneTransformApply() with NULL psPlaneTransform.  Should generate error, return NULL.\n");
-    rc = psPlaneTransformApply(NULL, NULL, &in);
+        if (FLT_EPSILON < fabs(out->y - in->y)) {
+            psError(PS_ERR_UNKNOWN,true,"out.y is %lf, should be %lf", out->y, in->y);
+            return 4;
+        }
+    }
+    psFree(out);
+
+    // Verify return null and error message generater for null specified transform
+    psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message for NULL psPlaneTransform");
+    rc = psPlaneTransformApply(NULL, NULL, in);
     if (rc != NULL) {
-        printf("TEST ERROR: psPlaneTransformApply() did not return NULL.\n");
-        testStatus = false;
-        rc = NULL;
-    }
-
-    printf("-------------------------------------------------------------------\n");
-    printf("Calling psPlaneTransformApply() with NULL psPlaneTransform->x.  Should generate error, return NULL.\n");
-    tmp2DPoly = pt.x;
-    pt.x = NULL;
-    rc = psPlaneTransformApply(NULL, &pt, &in);
+        psError(PS_ERR_UNKNOWN,true,"Function did not return NULL as expected for NULL psPlaneTransform.");
+        return 5;
+    }
+
+    // Verify return null and error message generated for null psPlaneTransform x coeff
+    psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message for NULL x coeff psPlaneTransform");
+    tmp2DPoly = pt->x;
+    pt->x = NULL;
+    rc = psPlaneTransformApply(NULL, pt, in);
     if (rc != NULL) {
-        printf("TEST ERROR: psPlaneTransformApply() did not return NULL.\n");
-        testStatus = false;
-        rc = NULL;
-    }
-    pt.x = tmp2DPoly;
-
-    printf("-------------------------------------------------------------------\n");
-    printf("Calling psPlaneTransformApply() with NULL psPlaneTransform->y.  Should generate error, return NULL.\n");
-    tmp2DPoly = pt.y;
-    pt.y = NULL;
-    rc = psPlaneTransformApply(NULL, &pt, &in);
+        psError(PS_ERR_UNKNOWN,true,"Function did not return NULL as expected for NULL x coeff psPlaneTransform");
+        return 6;
+    }
+    pt->x = tmp2DPoly;
+
+    // Verify return null and error message generated for null psPlaneTransform y coeff
+    psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message for NULL y coeff psPlaneTransform");
+    tmp2DPoly = pt->y;
+    pt->y = NULL;
+    rc = psPlaneTransformApply(NULL, pt, in);
     if (rc != NULL) {
-        printf("TEST ERROR: psPlaneTransformApply() did not return NULL.\n");
-        testStatus = false;
-        rc = NULL;
-    }
-    pt.y = tmp2DPoly;
-
-    printf("-------------------------------------------------------------------\n");
-    printf("Calling psPlaneTransformApply() with NULL input coords.  Should generate error, return NULL.\n");
-    rc = psPlaneTransformApply(NULL, &pt, NULL);
+        psError(PS_ERR_UNKNOWN,true,"Function did not return NULL as expected for NULL y coeff psPlaneTransform");
+        return 7;
+    }
+    pt->y = tmp2DPoly;
+
+    // Verify return null and error message generated for null psPlane coordinate
+    psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message for NULL psPlane");
+    rc = psPlaneTransformApply(NULL, pt, NULL);
     if (rc != NULL) {
-        printf("TEST ERROR: psPlaneTransformApply() did not return NULL.\n");
-        testStatus = false;
-        rc = NULL;
-    }
-
-    printf("-------------------------------------------------------------------\n");
-    psFree(pt.x);
-    psFree(pt.y);
-    return(testStatus);
+        psError(PS_ERR_UNKNOWN,true,"Function did not return NULL as expected for NULL psPlane");
+        return 8;
+    }
+
+    psFree(pt);
+    psFree(in);
+
+    return 0;
 }
 
Index: /trunk/psLib/test/astronomy/verified/tst_psCoord.stderr
===================================================================
--- /trunk/psLib/test/astronomy/verified/tst_psCoord.stderr	(revision 3430)
+++ /trunk/psLib/test/astronomy/verified/tst_psCoord.stderr	(revision 3431)
@@ -56,10 +56,18 @@
 \**********************************************************************************/
 
+<DATE><TIME>|<HOST>|I|testPlaneTransformApply
+    Following should generate error message for NULL psPlaneTransform
 <DATE><TIME>|<HOST>|E|psPlaneTransformApply (FILE:LINENO)
     Unallowable operation: transform is NULL.
+<DATE><TIME>|<HOST>|I|testPlaneTransformApply
+    Following should generate error message for NULL x coeff psPlaneTransform
 <DATE><TIME>|<HOST>|E|psPlaneTransformApply (FILE:LINENO)
     Unallowable operation: transform->x is NULL.
+<DATE><TIME>|<HOST>|I|testPlaneTransformApply
+    Following should generate error message for NULL y coeff psPlaneTransform
 <DATE><TIME>|<HOST>|E|psPlaneTransformApply (FILE:LINENO)
     Unallowable operation: transform->y is NULL.
+<DATE><TIME>|<HOST>|I|testPlaneTransformApply
+    Following should generate error message for NULL psPlane
 <DATE><TIME>|<HOST>|E|psPlaneTransformApply (FILE:LINENO)
     Unallowable operation: coords is NULL.
Index: /trunk/psLib/test/astronomy/verified/tst_psCoord.stdout
===================================================================
--- /trunk/psLib/test/astronomy/verified/tst_psCoord.stdout	(revision 3430)
+++ /trunk/psLib/test/astronomy/verified/tst_psCoord.stdout	(revision 3431)
@@ -1,11 +1,2 @@
--------------------------------------------------------------------
-Calling psPlaneTransformApply() with NULL psPlaneTransform.  Should generate error, return NULL.
--------------------------------------------------------------------
-Calling psPlaneTransformApply() with NULL psPlaneTransform->x.  Should generate error, return NULL.
--------------------------------------------------------------------
-Calling psPlaneTransformApply() with NULL psPlaneTransform->y.  Should generate error, return NULL.
--------------------------------------------------------------------
-Calling psPlaneTransformApply() with NULL input coords.  Should generate error, return NULL.
--------------------------------------------------------------------
 -------------------------------------------------------------------
 Calling psPlaneDistortApply() with NULL psPlaneDistort.  Should generate error, return NULL.
