Index: /trunk/psLib/test/astronomy/tst_psAstrometry01.c
===================================================================
--- /trunk/psLib/test/astronomy/tst_psAstrometry01.c	(revision 3554)
+++ /trunk/psLib/test/astronomy/tst_psAstrometry01.c	(revision 3555)
@@ -5,6 +5,6 @@
 *  @author GLG, MHPCC
 *
-*  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2005-03-29 19:41:38 $
+*  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2005-03-30 00:16:51 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -18,4 +18,6 @@
 static psS32 test3( void );
 static psS32 test4( void );
+static psS32 test5( void );
+static psS32 test6( void );
 
 testDescription tests[] = {
@@ -23,5 +25,7 @@
                               {test2, -2, "Tests psGrommitAlloc()", 0, false},
                               {test3, -3, "MISC", 0, false},
-                              {test4, -1, "psPlaneTransformCombineTmp()", 0, false},
+                              {test4, -1, "psPlaneTransformCombine()", 0, false},
+                              {test5, -1, "psPlaneTransformFit()", 0, false},
+                              {test6, -1, "psPlaneTransformInvert()", 0, false},
                               {NULL}
                           };
@@ -532,8 +536,5 @@
         }
     }
-
-    printf("HERE 00\n");
     psFree(myFPA);
-    printf("HERE 01\n");
 
     return(0);
@@ -559,9 +560,22 @@
 }
 
-// XXX: This function must verify the outputs.
+/******************************************************************************
+XXX: This is only a rudimentary test of the psPlaneTransformCombine()
+function.  It tests a few NULL input parameter conditions.  Then, it combines
+two very simply functions and prints the result to the screen.  No values are
+checked.
+ 
+// XXX: This function must verify the outputs of the combined functions.
+ 
+// XXX: Must do: Run thru several combinations of random parameters, then pipe
+   random x/y values thru both trans1+trans2, as well as the combined function
+   and verify the output.
+ *****************************************************************************/
 psS32 test4( void )
 {
+    bool testStatus = true;
     psPlaneTransform *trans1 = psPlaneTransformAlloc(2, 2);
     psPlaneTransform *trans2 = psPlaneTransformAlloc(2, 2);
+    psPlaneTransform *trans3 = NULL;
 
     printf("trans1: x = x+y, y = x+y\n");
@@ -598,14 +612,168 @@
     printTrans(trans2);
 
-
-
-    psPlaneTransform *trans3 = psPlaneTransformCombine(NULL, trans1, trans2);
-
+    printf("----------------------------------------------------------------------------------\n");
+    printf("Calling psPlaneTransformCombine with NULL trans1.  Should generate error and return NULL.\n");
+    trans3 = psPlaneTransformCombine(NULL, NULL, trans2);
+    if (trans3 != NULL) {
+        printf("TEST ERROR: psPlaneTransformCombine() returned a non-NULL psPlaneTransform.\n");
+        testStatus = false;
+        psFree(trans3);
+    }
+
+    printf("----------------------------------------------------------------------------------\n");
+    printf("Calling psPlaneTransformCombine with NULL trans2.  Should generate error and return NULL.\n");
+    trans3 = psPlaneTransformCombine(NULL, trans1, NULL);
+    if (trans3 != NULL) {
+        printf("TEST ERROR: psPlaneTransformCombine() returned a non-NULL psPlaneTransform.\n");
+        testStatus = false;
+        psFree(trans3);
+    }
+
+
+    printf("----------------------------------------------------------------------------------\n");
+    printf("Calling psPlaneTransformCombine with acceptable data.\n");
+    trans3 = psPlaneTransformCombine(NULL, trans1, trans2);
+    if (trans3 == NULL) {
+        printf("TEST ERROR: psPlaneTransformCombine() returned a NULL psPlaneTransform.\n");
+        testStatus = false;
+        psFree(trans3);
+    }
     printf("trans3: \n");
     printTrans(trans3);
+
     psFree(trans1);
     psFree(trans2);
     psFree(trans3);
-    return(0);
+
+    return(!testStatus);
+}
+
+#define NUM_DATA 100
+
+/******************************************************************************
+XXX: This is only a rudimentary test of the psPlaneTransformFit() function.
+It tests a few NULL input parameter conditions.
+ 
+XXX: We call it with acceptable data, but we do not verify the output.
+ *****************************************************************************/
+psS32 test5( void )
+{
+    bool testStatus = true;
+    psPlaneTransform *trans = psPlaneTransformAlloc(2, 2);
+    psArray *src = psArrayAlloc(NUM_DATA);
+    psArray *dst = psArrayAlloc(NUM_DATA);
+    bool rc;
+
+    for (psS32 i = 0 ; i < NUM_DATA ; i++) {
+        src->data[i] = (psPtr *) psVectorAlloc(2, PS_TYPE_F32);
+        dst->data[i] = (psPtr *) psVectorAlloc(2, PS_TYPE_F32);
+        ((psVector *) src->data[i])->data.F32[0] = (psF32) i;
+        ((psVector *) src->data[i])->data.F32[1] = (psF32) i;
+        ((psVector *) dst->data[i])->data.F32[0] = (psF32) 2+i;
+        ((psVector *) dst->data[i])->data.F32[1] = (psF32) 3+i;
+    }
+
+    printf("----------------------------------------------------------------------------------\n");
+    printf("Calling psPlaneTransformFit with NULL trans.  Should generate error and return NULL.\n");
+    rc = psPlaneTransformFit(NULL, src, dst, 100, 100.0);
+    if (rc == true) {
+        printf("TEST ERROR: psPlaneTransformFit() returned TRUE.\n");
+        testStatus = false;
+    }
+
+    printf("----------------------------------------------------------------------------------\n");
+    printf("Calling psPlaneTransformFit with NULL src psArray.  Should generate error and return NULL.\n");
+    rc = psPlaneTransformFit(trans, NULL, dst, 100, 100.0);
+    if (rc == true) {
+        printf("TEST ERROR: psPlaneTransformFit() returned TRUE.\n");
+        testStatus = false;
+    }
+
+    printf("----------------------------------------------------------------------------------\n");
+    printf("Calling psPlaneTransformFit with NULL dst psArray.  Should generate error and return NULL.\n");
+    rc = psPlaneTransformFit(trans, src, NULL, 100, 100.0);
+    if (rc == true) {
+        printf("TEST ERROR: psPlaneTransformFit() returned TRUE.\n");
+        testStatus = false;
+    }
+
+    printf("----------------------------------------------------------------------------------\n");
+    printf("Calling psPlaneTransformFit with acceptable data.\n");
+    rc = psPlaneTransformFit(trans, src, dst, 100, 100.0);
+    if (rc != true) {
+        printf("TEST ERROR: psPlaneTransformFit() returned TRUE.\n");
+        testStatus = false;
+    }
+
+    psFree(trans);
+    psFree(src);
+    psFree(dst);
+    return(!testStatus);
+}
+
+/******************************************************************************
+XXX: This is only a rudimentary test of the psPlaneTransform()
+function.  It tests a few NULL input parameter conditions.
+ 
+XXX: We call it with acceptable data, but we do not verify the output.
+ *****************************************************************************/
+psS32 test6( void )
+{
+    bool testStatus = true;
+    psPlaneTransform *trans = psPlaneTransformAlloc(2, 2);
+    psPlaneTransform *transOut = NULL;
+    psRegion *myRegion = psRegionAlloc(1.0, 5.0, 1.0, 5.0);
+
+    //
+    // Set non-linear transformation
+    //
+    trans->x->coeff[0][0] = 1.0;
+    trans->x->coeff[0][1] = 1.0;
+    trans->x->coeff[1][0] = 1.0;
+    trans->x->coeff[1][1] = 1.0;
+    trans->y->coeff[0][0] = 1.0;
+    trans->y->coeff[0][1] = 1.0;
+    trans->y->coeff[1][0] = 1.0;
+    trans->y->coeff[1][1] = 1.0;
+
+    printf("----------------------------------------------------------------------------------\n");
+    printf("Calling psPlaneTransformInvert with NULL trans.  Should generate error and return NULL.\n");
+    transOut = psPlaneTransformInvert(NULL, NULL, myRegion, 10);
+    if (transOut != NULL) {
+        printf("TEST ERROR: psPlaneTransformInvert() returned a non-NULL psPlaneTransform.\n");
+        testStatus = false;
+        psFree(transOut);
+    }
+
+    printf("----------------------------------------------------------------------------------\n");
+    printf("Calling psPlaneTransformInvert with NULL psRegion.  Should generate error and return NULL.\n");
+    transOut = psPlaneTransformInvert(NULL, trans, NULL, 10);
+    if (transOut != NULL) {
+        printf("TEST ERROR: psPlaneTransformInvert() returned a non-NULL psPlaneTransform.\n");
+        testStatus = false;
+        psFree(transOut);
+    }
+    printf("----------------------------------------------------------------------------------\n");
+    printf("Calling psPlaneTransformInvert with zero nSamples.  Should generate error and return NULL.\n");
+    transOut = psPlaneTransformInvert(NULL, trans, myRegion, 0);
+    if (transOut != NULL) {
+        printf("TEST ERROR: psPlaneTransformInvert() returned a non-NULL psPlaneTransform.\n");
+        testStatus = false;
+        psFree(transOut);
+    }
+
+    printf("----------------------------------------------------------------------------------\n");
+    printf("Calling psPlaneTransformInvert with acceptable data.\n");
+    transOut = psPlaneTransformInvert(NULL, trans, myRegion, 10);
+    if (transOut == NULL) {
+        printf("TEST ERROR: psPlaneTransformInvert() returned a NULL psPlaneTransform.\n");
+        testStatus = false;
+    }
+
+    psFree(trans);
+    psFree(transOut);
+    psFree(myRegion);
+
+    return(!testStatus);
 }
 //This code is
