Index: /trunk/psLib/test/astronomy/tst_psCoord.c
===================================================================
--- /trunk/psLib/test/astronomy/tst_psCoord.c	(revision 3431)
+++ /trunk/psLib/test/astronomy/tst_psCoord.c	(revision 3432)
@@ -6,6 +6,6 @@
 *  @author GLG, MHPCC
 *
-*  @version $Revision: 1.24 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2005-03-16 02:31:05 $
+*  @version $Revision: 1.25 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2005-03-16 03:26:39 $
 *
 *  XXX: THe psProject() and psDeproject() functions do not work fully.  They
@@ -25,5 +25,5 @@
 static psS32 testPlaneDistortAlloc( void );
 static psS32 testPlaneTransformApply( void );
-static psS32 test3( void );
+static psS32 testPlaneDistortApply( void );
 static psS32 testSphereTransformApply1( void );
 static psS32 testSphereTransformApply2( void );
@@ -46,6 +46,6 @@
                               {testPlaneTransformAlloc, 826, "psPlaneTransformAlloc()", 0, false},
                               {testPlaneDistortAlloc, 827, "psPlaneDistortAlloc()", 0, false},
-                              {testPlaneTransformApply, 0000, "psPlaneTransformApply()", 0, false},
-                              {test3, 0000, "psPlaneDistortApply()", 0, false},
+                              {testPlaneTransformApply, 831, "psPlaneTransformApply()", 0, false},
+                              {testPlaneDistortApply, 832, "psPlaneDistortApply()", 0, false},
                               {testSphereTransformApply1, 820, "psSphereTransformApply()", 0, false},
                               {testSphereTransformApply2, 820, "psSphereTransformApply()", 0, false},
@@ -387,89 +387,92 @@
 // We do a simple identity transformation on a few x,y pairs.  For x and y,
 // we add in the COLOR and MAGNITUDE.
-psS32 test3( void )
-{
-    psS32 i;
-    psS32 testStatus = 0;
-    psPlane in;
-    psPlane out;
-    psPlaneDistort pt;
-    psPlane *rc = NULL;
-    psDPolynomial4D *tmp4DPoly = NULL;
-
-    pt.x = psDPolynomial4DAlloc(2, 2, 2, 2, PS_POLYNOMIAL_ORD);
-    pt.y = psDPolynomial4DAlloc(2, 2, 2, 2, PS_POLYNOMIAL_ORD);
-    pt.x->coeff[1][0][0][0] = 1.0;
-    pt.x->coeff[0][0][1][0] = 1.0;
-    pt.x->coeff[0][0][0][1] = 1.0;
-    pt.y->coeff[0][1][0][0] = 1.0;
-    pt.y->coeff[0][0][1][0] = 1.0;
-    pt.y->coeff[0][0][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;
-        psPlaneDistortApply(&out, &pt, &in, COLOR, MAGNITUDE);
-
-        if (FLT_EPSILON < fabs(out.x - COLOR - MAGNITUDE - in.x)) {
-            printf("ERROR: out.x is %f, should be %f\n", out.x, in.x + COLOR + MAGNITUDE);
-            testStatus = 3;
+psS32 testPlaneDistortApply( void )
+{
+    psPlane*         out       = NULL;
+    psPlane*         rc        = NULL;
+    psDPolynomial4D* tmp4DPoly = NULL;
+
+    // Allocate input coordinate
+    psPlane* in = psPlaneAlloc();
+
+    // Create psPlaneTransform structure
+    psPlaneDistort*  pt = psPlaneDistortAlloc(2, 2, 2, 2);
+
+    pt->x->coeff[1][0][0][0] = 1.0;
+    pt->x->coeff[0][0][1][0] = 1.0;
+    pt->x->coeff[0][0][0][1] = 1.0;
+
+    pt->y->coeff[0][1][0][0] = 1.0;
+    pt->y->coeff[0][0][1][0] = 1.0;
+    pt->y->coeff[0][0][0][1] = 1.0;
+
+    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;
+        out = psPlaneDistortApply(out, pt, in, COLOR, MAGNITUDE);
+
+        // Verify return value is not NULL
+        if(out == NULL) {
+            psError(PS_ERR_UNKNOWN,true,"Expected non-NULL return");
+            return 1;
         }
-
-        if (FLT_EPSILON < fabs(out.y - COLOR - MAGNITUDE - in.y)) {
-            printf("ERROR: out.y is %f, should be %f\n", out.y, in.y + COLOR + MAGNITUDE);
-            testStatus = 3;
+        // Verify return value contains expected values
+        if (FLT_EPSILON < fabs(out->x - COLOR - MAGNITUDE - in->x)) {
+            psError(PS_ERR_UNKNOWN,true,"out->x is %lf, should be %lf",
+                    out->x, in->x + COLOR + MAGNITUDE);
+            return 2;
         }
-        //printf("psPlaneTransformApply(): (%f, %f) -> (%f, %f)\n", in.x, in.y, out.x, out.y);
-    }
-
-    printf("-------------------------------------------------------------------\n");
-    printf("Calling psPlaneDistortApply() with NULL psPlaneDistort.  Should generate error, return NULL.\n");
-    rc = psPlaneDistortApply(NULL, NULL, &in, COLOR, MAGNITUDE);
+        if (FLT_EPSILON < fabs(out->y - COLOR - MAGNITUDE - in->y)) {
+            psError(PS_ERR_UNKNOWN,true,"out->y is %lf, should be %lf",
+                    out->y, in->y + COLOR + MAGNITUDE);
+            return 3;
+        }
+    }
+    psFree(out);
+
+    // Attempt to invoke psPlaneDistortApply with NULL psPlaneDistort
+    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message for null psPlaneDistort");
+    rc = psPlaneDistortApply(NULL, NULL, in, COLOR, MAGNITUDE);
     if (rc != NULL) {
-        printf("TEST ERROR: psPlaneDistortApply() did not return NULL.\n");
-        testStatus = false;
-        rc = NULL;
-    }
-
-    printf("-------------------------------------------------------------------\n");
-    printf("Calling psPlaneDistortApply() with NULL psPlaneDistort->x.  Should generate error, return NULL.\n");
-    tmp4DPoly = pt.x;
-    pt.x = NULL;
-    rc = psPlaneDistortApply(NULL, &pt, &in, COLOR, MAGNITUDE);
+        psError(PS_ERR_UNKNOWN,true,"Did not return NULL.");
+        return 4;
+    }
+
+    // Attempt to invoke psPlaneDistortApply with NULL psPlaneDistort x member
+    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message for null x member psPlaneDistort");
+    tmp4DPoly = pt->x;
+    pt->x = NULL;
+    rc = psPlaneDistortApply(NULL, pt, in, COLOR, MAGNITUDE);
     if (rc != NULL) {
-        printf("TEST ERROR: psPlaneDistortApply() did not return NULL.\n");
-        testStatus = false;
-        rc = NULL;
-    }
-    pt.x = tmp4DPoly;
-
-    printf("-------------------------------------------------------------------\n");
-    printf("Calling psPlaneDistortApply() with NULL psPlaneDistort->y.  Should generate error, return NULL.\n");
-    tmp4DPoly = pt.y;
-    pt.y = NULL;
-    rc = psPlaneDistortApply(NULL, &pt, &in, COLOR, MAGNITUDE);
+        psError(PS_ERR_UNKNOWN,true,"Did not return NULL.");
+        return 5;
+    }
+    pt->x = tmp4DPoly;
+
+    // Attempt to invoke psPlaneDistortApply with NULL psPlaneDistort y member
+    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message for null y member psPlaneDistort");
+    tmp4DPoly = pt->y;
+    pt->y = NULL;
+    rc = psPlaneDistortApply(NULL, pt, in, COLOR, MAGNITUDE);
     if (rc != NULL) {
-        printf("TEST ERROR: psPlaneDistortApply() did not return NULL.\n");
-        testStatus = false;
-        rc = NULL;
-    }
-    pt.y = tmp4DPoly;
-
-    printf("-------------------------------------------------------------------\n");
-    printf("Calling psPlaneDistortApply() with NULL input coords.  Should generate error, return NULL.\n");
-    rc = psPlaneDistortApply(NULL, &pt, NULL, COLOR, MAGNITUDE);
+        psError(PS_ERR_UNKNOWN,true,"Did not return NULL.");
+        return 6;
+    }
+    pt->y = tmp4DPoly;
+
+    // Attempt to invoke psPlaneDistortApply with NULL input psPlane
+    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message for null input psPlane");
+    rc = psPlaneDistortApply(NULL, pt, NULL, COLOR, MAGNITUDE);
     if (rc != NULL) {
-        printf("TEST ERROR: psPlaneDistortApply() did not return NULL.\n");
-        testStatus = false;
-        rc = NULL;
-    }
-
-
-
-    printf("-------------------------------------------------------------------\n");
-    psFree(pt.x);
-    psFree(pt.y);
-    return(testStatus);
+        psError(PS_ERR_UNKNOWN,true,"Did not return NULL");
+        return 7;
+    }
+
+    psFree(pt);
+    psFree(in);
+
+    return 0;
 }
 
Index: /trunk/psLib/test/astronomy/verified/tst_psCoord.stderr
===================================================================
--- /trunk/psLib/test/astronomy/verified/tst_psCoord.stderr	(revision 3431)
+++ /trunk/psLib/test/astronomy/verified/tst_psCoord.stderr	(revision 3432)
@@ -81,10 +81,18 @@
 \**********************************************************************************/
 
+<DATE><TIME>|<HOST>|I|testPlaneDistortApply
+    Following should generate an error message for null psPlaneDistort
 <DATE><TIME>|<HOST>|E|psPlaneDistortApply (FILE:LINENO)
     Unallowable operation: transform is NULL.
+<DATE><TIME>|<HOST>|I|testPlaneDistortApply
+    Following should generate an error message for null x member psPlaneDistort
 <DATE><TIME>|<HOST>|E|psPlaneDistortApply (FILE:LINENO)
     Unallowable operation: transform->x is NULL.
+<DATE><TIME>|<HOST>|I|testPlaneDistortApply
+    Following should generate an error message for null y member psPlaneDistort
 <DATE><TIME>|<HOST>|E|psPlaneDistortApply (FILE:LINENO)
     Unallowable operation: transform->y is NULL.
+<DATE><TIME>|<HOST>|I|testPlaneDistortApply
+    Following should generate an error message for null input psPlane
 <DATE><TIME>|<HOST>|E|psPlaneDistortApply (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 3431)
+++ /trunk/psLib/test/astronomy/verified/tst_psCoord.stdout	(revision 3432)
@@ -1,11 +1,2 @@
--------------------------------------------------------------------
-Calling psPlaneDistortApply() with NULL psPlaneDistort.  Should generate error, return NULL.
--------------------------------------------------------------------
-Calling psPlaneDistortApply() with NULL psPlaneDistort->x.  Should generate error, return NULL.
--------------------------------------------------------------------
-Calling psPlaneDistortApply() with NULL psPlaneDistort->y.  Should generate error, return NULL.
--------------------------------------------------------------------
-Calling psPlaneDistortApply() with NULL input coords.  Should generate error, return NULL.
--------------------------------------------------------------------
 -------------------------------------------------------------------
 Calling psSphereGetOffset() with NULL position1.  Should generate error, return NULL.
