Index: trunk/psLib/test/math/tap_psFunc01.c
===================================================================
--- trunk/psLib/test/math/tap_psFunc01.c	(revision 13123)
+++ trunk/psLib/test/math/tap_psFunc01.c	(revision 13124)
@@ -10,4 +10,5 @@
 #include "tap.h"
 #include "pstap.h"
+
 #define MY_MEAN 5.0
 #define MY_STDEV 2.0
@@ -21,8 +22,8 @@
     plan_tests(4);
 
+
     // Test the psGaussian(): normalized version
     {
         psMemId id = psMemGetId();
-
         bool errorFlag = false;
         for (psS32 x = 0 ; x < (int) (MY_MEAN * 2.0) ; x++)
@@ -37,4 +38,5 @@
         ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     }
+
 
     // Test the psGaussian(): non-normalized version
Index: trunk/psLib/test/math/tap_psMatrix01.c
===================================================================
--- trunk/psLib/test/math/tap_psMatrix01.c	(revision 13123)
+++ trunk/psLib/test/math/tap_psMatrix01.c	(revision 13124)
@@ -4,13 +4,11 @@
 *
 *  This test driver contains the following tests:
-*     Create input images
 *     Transpose input image into output image
 *     Transpose input image into auto allocated NULL output image
-*     Free input images
 *
 *  @author  Ross Harman, MHPCC
 *
-*  @version $Revision: 1.1 $  $Name: not supported by cvs2svn $
-*  @date  $Date: 2006-12-20 20:02:29 $
+*  @version $Revision: 1.2 $  $Name: not supported by cvs2svn $
+*  @date  $Date: 2007-05-02 04:20:06 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -54,6 +52,29 @@
 psS32 main( psS32 argc, char* argv[] )
 {
-    plan_tests(10);
-    // Preliminary: Create input images
+    plan_tests(14);
+
+
+    // Verify with NULL input params
+    {
+        psMemId id = psMemGetId();
+        psImage *outImage = psMatrixTranspose(NULL, NULL);
+        ok(outImage == NULL, "psMatrixTranspose() returned NULL with NULL input params");
+        psFree(outImage);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+
+    // Verify with incorrect input image type
+    {
+        psMemId id = psMemGetId();
+        psImage *inImage = (psImage*)psImageAlloc(3, 3, PS_TYPE_S64);
+        psImage *outImage = psMatrixTranspose(NULL, inImage);
+        ok(outImage == NULL, "psMatrixTranspose() returned NULL with incorrect input image type");
+        psFree(inImage);
+        psFree(outImage);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+
     psImage *inImage = (psImage*)psImageAlloc(3, 3, PS_TYPE_F64);
     psImage *outImage = (psImage*)psImageAlloc(3, 3, PS_TYPE_F64);
@@ -79,5 +100,5 @@
     inImageF32->data.F32[2][2] = 9;
 
-    // Test A - Transpose input image into output image
+    // Transpose input image into output image
     {
         psMemId id = psMemGetId();
@@ -99,13 +120,12 @@
     }
 
-    // Test B - Transpose input image into auto allocated NULL output image
+
+    // Transpose input image into auto allocated NULL output image
     {
         psMemId id = psMemGetId();
-        psImage *outImageNull = NULL;
-        outImageNull = psMatrixTranspose(outImageNull, inImage);
+        psImage *outImageNull = psMatrixTranspose(NULL, inImage);
         ok(!check_matrix(outImageNull), "Output image data set correctly");
 
-        psImage *outImageNullF32 = NULL;
-        outImageNullF32 = psMatrixTranspose(outImageNullF32, inImageF32);
+        psImage *outImageNullF32 = psMatrixTranspose(NULL, inImageF32);
         check_matrix(outImageNullF32);
         ok(!check_matrix(outImageNullF32), "Output image data set correctly");
Index: trunk/psLib/test/math/tap_psMatrix02.c
===================================================================
--- trunk/psLib/test/math/tap_psMatrix02.c	(revision 13123)
+++ trunk/psLib/test/math/tap_psMatrix02.c	(revision 13124)
@@ -12,6 +12,6 @@
  *  @author  Ross Harman, MHPCC
  *
- *  @version $Revision: 1.2 $  $Name: not supported by cvs2svn $
- *  @date  $Date: 2007-03-14 00:39:51 $
+ *  @version $Revision: 1.3 $  $Name: not supported by cvs2svn $
+ *  @date  $Date: 2007-05-02 04:20:06 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -24,11 +24,14 @@
 #include "pstap.h"
 
-psS32 main(psS32 argc,
-           char* argv[])
+int main(psS32 argc,
+         char* argv[])
 {
     psLogSetFormat("HLNM");
     plan_tests(11);
 
-    // Test A - Input pointer same as output pointer
+    // Input pointer same as output pointer
+    // XXX: This results in a seg fault.  It's not clear that passing this test is
+    // a requirement.  However, we should probably fix the case where the input
+    // image equals the output image.
     if (0) {
         psMemId id = psMemGetId();
@@ -40,5 +43,7 @@
     }
 
-    // Test B - Null input psImage
+
+    // Null input psImage
+    // Merge with tap_psMatrix01.c, get rid of this test (redundant)
     {
         psMemId id = psMemGetId();
@@ -52,5 +57,7 @@
     }
 
-    // Test C - Incorrect type for input pointer
+
+    // Incorrect type for input pointer
+    // Merge with tap_psMatrix01.c, get rid of this test (redundant)
     {
         psMemId id = psMemGetId();
@@ -65,5 +72,6 @@
     }
 
-    // Test D - Incorrect type for output pointer
+
+    // Incorrect type for output pointer
     {
         psMemId id = psMemGetId();
@@ -79,5 +87,6 @@
     }
 
-    // Test E - Matrix not square for output pointer
+
+    // Matrix not square for output pointer
     // XXX: We should probably do more here.
     {
@@ -90,4 +99,3 @@
         ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     }
-    return 0;
 }
Index: trunk/psLib/test/math/tap_psMinimizeLMM.c
===================================================================
--- trunk/psLib/test/math/tap_psMinimizeLMM.c	(revision 13123)
+++ trunk/psLib/test/math/tap_psMinimizeLMM.c	(revision 13124)
@@ -2,7 +2,11 @@
     This routine must ensure that psMinimizeLM() works correctly.
  
-    XXX: This code needs a lot of additional test case work.
-         The minimization currently (always?) fails and we don't
-         attempt to check the output values.
+    XXX: This code needs a lot of additional test case work.  The minimization
+	 currently fails and we don't attempt to check the output values.
+    XXX: Add tests for
+	covar arg set to non-NULL
+	constraint set to non-NULL
+        Set x->vectors to NULL, or use wrong types
+        yWt (errors) vector set to incorrect size, type.
  *****************************************************************************/
 #include <stdio.h>
@@ -19,5 +23,5 @@
 float expectedParm[NUM_PARAMS];
 
-
+// y = p2 + p0 * e^( x0^2 + x1^2 / (2 * p1^2) )
 float function(const psVector *params, const psVector *x)
 {
@@ -35,13 +39,4 @@
 
 
-/*****************************************************************************
-fitFunc():
-    sum = param[0] * x[0] * x[1] +
-          param[1] * x[0] +
-          param[2] * x[0]^2 +
-          param[3] * x[1] +
-          param[4] * x[1]^2
- 
- *****************************************************************************/
 psF32 fitFunc(psVector *deriv,
               psVector *params,
@@ -56,4 +51,5 @@
 }
 
+
 #define NUM_ITER 10
 #define TOL  20.0
@@ -62,5 +58,7 @@
     psLogSetFormat("HLNM");
     psLogSetLevel(PS_LOG_INFO);
-    plan_tests(2);
+    plan_tests(34);
+
+
     // Test psMinimizationAlloc()
     {
@@ -79,22 +77,128 @@
     }
 
-    /*
-        // Test psMinConstrainAlloc()
-        {
-            psMemId id = psMemGetId();
-            psMinConstrain *tmp = psMinConstrainAlloc(NUM_ITER, TOL);
-            ok(tmp != NULL. "psMinConstrainAlloc() returned non-NULL");
-            skip_start(tmp == NULL, 4, "Skipping tests because psMinConstrainAlloc() failed");
-            ok(tmp->paramMask == NULL, "psMinConstrainAlloc() properly set ->paramMask");
-            ok(tmp->paramMax == NULL, "psMinConstrainAlloc() properly set ->paramMax");
-            ok(tmp->paramMin == NULL, "psMinConstrainAlloc() properly set ->paramMin");
-            ok(tmp->paramDelta == NULL, "psMinConstrainAlloc() properly set ->paramDelta");
-            psFree(tmp);
-            skip_end();
-            ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
-        }
-    */
-
-    // Test psMinimizeLMChi2()
+
+    // Test psMinConstraintAlloc()
+    {
+        psMemId id = psMemGetId();
+        psMinConstraint *tmp = psMinConstraintAlloc();
+        ok(tmp != NULL, "psMinConstraintAlloc() returned non-NULL");
+        skip_start(tmp == NULL, 2, "Skipping tests because psMinConstraintAlloc() failed");
+        ok(tmp->paramMask == NULL, "psMinConstraintAlloc() properly set ->paramMask");
+        ok(tmp->checkLimits == NULL, "psMinConstraintAlloc() properly set ->checkLimits");
+        psFree(tmp);
+        skip_end();
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+
+    // Test psMinimizeLMChi2(): unallowed input parameters.
+    {
+        psMemId id = psMemGetId();
+        psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS, 1); // Random number generator; using known seed
+        psMinimization *min = psMinimizationAlloc(NUM_ITERATIONS, ERR_TOL);
+        psArray *ordinates = psArrayAlloc(NUM_DATA_POINTS);
+        psVector *coordinates = psVectorAlloc(NUM_DATA_POINTS, PS_TYPE_F32);
+        psVector *coordinatesF64 = psVectorAlloc(NUM_DATA_POINTS, PS_TYPE_F64);
+        psVector *errors = psVectorAlloc(NUM_DATA_POINTS, PS_TYPE_F32);
+        psVector *params = psVectorAlloc(NUM_PARAMS, PS_TYPE_F32);
+        psVector *paramsF64 = psVectorAlloc(NUM_PARAMS, PS_TYPE_F64);
+        psVector *trueParams = psVectorAlloc(NUM_PARAMS, PS_TYPE_F32);
+
+        // Test with psMinimization set to NULL
+        {
+            psMemId id = psMemGetId();
+            bool tmpBool = psMinimizeLMChi2(NULL, NULL, params, NULL, ordinates,
+                           coordinates, errors, (psMinimizeLMChi2Func)fitFunc);
+            ok(!tmpBool, "psMinimizeLMChi2() returned FALSE with NULL psMinimization");
+            ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+        }
+
+
+        // Test with params set to NULL
+        {
+            psMemId id = psMemGetId();
+            bool tmpBool = psMinimizeLMChi2(min, NULL, NULL, NULL, ordinates,
+                           coordinates, errors, (psMinimizeLMChi2Func)fitFunc);
+            ok(!tmpBool, "psMinimizeLMChi2() returned FALSE with NULL params");
+            ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+        }
+
+
+        // Test with params wrong type
+        {
+            psMemId id = psMemGetId();
+            bool tmpBool = psMinimizeLMChi2(min, NULL, paramsF64, NULL, ordinates,
+                           coordinates, errors, (psMinimizeLMChi2Func)fitFunc);
+            ok(!tmpBool, "psMinimizeLMChi2() returned FALSE with NULL params");
+            ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+        }
+
+
+        // Test with ordinates (x) set to NULL
+        {
+            psMemId id = psMemGetId();
+            bool tmpBool = psMinimizeLMChi2(min, NULL, params, NULL, NULL,
+                           coordinates, errors, (psMinimizeLMChi2Func)fitFunc);
+            ok(!tmpBool, "psMinimizeLMChi2() returned FALSE with NULL ordinates (x)");
+            ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+        }
+
+
+        // Test with coordinates (y) set to NULL
+        {
+            psMemId id = psMemGetId();
+            bool tmpBool = psMinimizeLMChi2(min, NULL, params, NULL, ordinates,
+                           NULL, errors, (psMinimizeLMChi2Func)fitFunc);
+            ok(!tmpBool, "psMinimizeLMChi2() returned FALSE with NULL coordinates (y)");
+            ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+        }
+
+
+        // Test with coordinates (y) wrong type (F64)
+        {
+            psMemId id = psMemGetId();
+            bool tmpBool = psMinimizeLMChi2(min, NULL, params, NULL, ordinates,
+                           coordinatesF64, errors, (psMinimizeLMChi2Func)fitFunc);
+            ok(!tmpBool, "psMinimizeLMChi2() returned FALSE with coordinates (y) wrong type");
+            ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+        }
+
+
+        // Test with ordinates and coordinates wrong size
+        {
+            psMemId id = psMemGetId();
+            coordinates->n--;
+            bool tmpBool = psMinimizeLMChi2(min, NULL, params, NULL, ordinates,
+                           coordinates, errors, (psMinimizeLMChi2Func)fitFunc);
+            ok(!tmpBool, "psMinimizeLMChi2() returned FALSE with NULL psMinimization");
+            coordinates->n++;
+            ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+        }
+
+
+        // Test with function set to NULL
+        {
+            psMemId id = psMemGetId();
+            bool tmpBool = psMinimizeLMChi2(min, NULL, params, NULL, ordinates,
+                           coordinates, errors, NULL);
+            ok(!tmpBool, "psMinimizeLMChi2() returned FALSE with NULL fit function");
+            ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+        }
+
+        psFree(min);
+        psFree(params);
+        psFree(paramsF64);
+        psFree(trueParams);
+        psFree(ordinates);
+        psFree(coordinates);
+        psFree(coordinatesF64);
+        psFree(errors);
+        psFree(rng);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+
+    // Test psMinimizeLMChi2() with legitimate input values
+    // Currently this fails, and we do not attempt to verify output
     {
         psMemId id = psMemGetId();
@@ -158,5 +262,5 @@
         }
         printf("Mean relative difference is %f\n", diff/(float)NUM_DATA_POINTS);
-
+        skip_end();
         psFree(min);
         psFree(params);
@@ -166,6 +270,5 @@
         psFree(errors);
         psFree(rng);
-        skip_end();
-        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
-    }
-}
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+}
Index: trunk/psLib/test/math/tap_psMinimizePowell.c
===================================================================
--- trunk/psLib/test/math/tap_psMinimizePowell.c	(revision 13123)
+++ trunk/psLib/test/math/tap_psMinimizePowell.c	(revision 13124)
@@ -9,4 +9,5 @@
     XXX: Also, the test currently fails because of memory corruption in
          psMinimizePowell().
+    XXX: The unallowed input parameter tests could be more extensive
  *****************************************************************************/
 #include <stdio.h>
@@ -74,10 +75,8 @@
 {
     psLogSetFormat("HLNM");
-    plan_tests(1);
+    plan_tests(8);
 
     // Check for various errors on unallowed input parameters
     {
-        psMemId id = psMemGetId();
-
         psVector *myParams = psVectorAlloc(NUM_PARAMS, PS_TYPE_F32);
         psVector *myParamMask = psVectorAlloc(NUM_PARAMS, PS_TYPE_U8);
@@ -85,43 +84,38 @@
         psArray *myCoords = psArrayAlloc(N);
 
-        for (psS32 i=0;i<N;i++)
+        // Following should generate error for NULL minimize
         {
-            myCoords->data[i] = (psPtr *) psVectorAlloc(2, PS_TYPE_F32);
-            ((psVector *) (myCoords->data[i]))->data.F32[0] = (float) (i+10);
-            ((psVector *) (myCoords->data[i]))->data.F32[1] = (float) (i+3);
-            ((psVector *) (myCoords->data[i]))->n++;
-        }
-        for (psS32 i=0;i<NUM_PARAMS;i++)
-        {
-            expectedParm[i] = 2.32 + (float) (2 * i);
-            myParams->data.F32[i] = 0.0;
-            myParams->data.F32[i] = (float) i;
-            myParamMask->data.U8[i] = 0;
-            myParams->n++;
-            myParamMask->n++;
+            psMemId id = psMemGetId();
+            bool tmpBool = psMinimizePowell(NULL, myParams, myParamMask, myCoords,
+                                           (psMinimizePowellFunc) myFunc);
+            ok(!tmpBool, "psMinimizePowell() returned FALSE with NULL psMinimize param");
+            ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
         }
 
-        // Following should generate error for null minimize
-        if (0)
+
+        // Following should generate error for NULL parameter vector
         {
-            psMinimizePowell(NULL, myParams, myParamMask, myCoords, (psMinimizePowellFunc) myFunc);
+            psMemId id = psMemGetId();
+            bool tmpBool = psMinimizePowell(min, NULL, myParamMask, myCoords,(psMinimizePowellFunc) myFunc);
+            ok(!tmpBool, "psMinimizePowell() returned FALSE with NULL parameter param");
+            ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
         }
 
-        // Following should generate error for null parameter vector
-        if (0)
+
+        // Following should generate error for NULL coords
         {
-            psMinimizePowell(min, NULL, myParamMask, myCoords,(psMinimizePowellFunc) myFunc);
+            psMemId id = psMemGetId();
+            bool tmpBool = psMinimizePowell(min, myParams, myParamMask, NULL, (psMinimizePowellFunc) myFunc);
+            ok(!tmpBool, "psMinimizePowell() returned FALSE with NULL coords param");
+            ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
         }
 
-        // Following should generate error for null coords
-        if (0)
+
+        // Following should generate error for NULL function
         {
-            psMinimizePowell(min, myParams, myParamMask, NULL, (psMinimizePowellFunc) myFunc);
-        }
-
-        // Following should generate error for null function
-        if (0)
-        {
-            psMinimizePowell(min, myParams, myParamMask, myCoords, NULL);
+            psMemId id = psMemGetId();
+            bool tmpBool = psMinimizePowell(min, myParams, myParamMask, myCoords, NULL);
+            ok(!tmpBool, "psMinimizePowell() returned FALSE with NULL function param");
+            ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
         }
 
@@ -130,8 +124,13 @@
         psFree(min);
         psFree(myCoords);
-        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     }
 
+
     // Powell minimize with parameter mask
+    // XXX: This function aborts with a memory corruption error at around line
+    // 60 of psMinimizePowell.c, at the psFree(v):
+    //    if (fabs(baseFuncVal - currFuncVal) <= min->tol) {
+    //        psFree(v);
+    //        psFree(pQP);
     if (0) {
         psMemId id = psMemGetId();
@@ -155,5 +154,5 @@
         }
 
-        bool tmpBool = psMinimizePowell(min, myParams, myParamMask, myCoords,
+        bool tmpBool = psMinimizePowell(min, myParams, NULL, myCoords,
                                         (psMinimizePowellFunc) myFunc);
         ok(tmpBool, "psMinimizePowell() returned sucessfully");
@@ -184,53 +183,4 @@
     }
 
-    // Powell minimize with parameter mask
-    // The only difference from the previous block is that paramMask is now NULL
-    if (0) {
-        psMemId id = psMemGetId();
-        psVector *myParams = psVectorAlloc(NUM_PARAMS, PS_TYPE_F32);
-        psMinimization *min = psMinimizationAlloc(100, 0.01);
-        psArray *myCoords = psArrayAlloc(N);
-        bool tmpBool;
-
-        myCoords->n = N;
-        for (psS32 i=0;i<N;i++)
-        {
-            myCoords->data[i] = (psPtr *) psVectorAlloc(2, PS_TYPE_F32);
-            ((psVector *) (myCoords->data[i]))->data.F32[0] = (float) (i+10);
-            ((psVector *) (myCoords->data[i]))->data.F32[1] = (float) (i+3);
-        }
-        for (psS32 i=0;i<NUM_PARAMS;i++)
-        {
-            expectedParm[i] = 2.32 + (float) (2 * i);
-            myParams->data.F32[i] = 0.0;
-            myParams->data.F32[i] = (float) i;
-            myParams->n++;
-        }
-
-        tmpBool = psMinimizePowell(min, myParams, NULL, myCoords,
-                                   (psMinimizePowellFunc) myFunc);
-        ok(tmpBool, "psMinimizePowell() returned sucessfully");
-        skip_start(!tmpBool, 0, "Skipping tests because psMinimizePowell() failed");
-
-        printf("\nThe minimum is %f (expected: %f)\n", min->value, MIN_VALUE);
-        for (psS32 i=0;i<NUM_PARAMS;i++)
-        {
-            printf("Parameter %d at the minimum is %.1f (expected: %.1f)\n", i,
-                   myParams->data.F32[i], expectedParm[i]);
-
-            if (fabs(myParams->data.F32[i] - expectedParm[i]) > fabs(ERROR_TOLERANCE * expectedParm[i])) {
-                printf("ERROR: Parameter %d: (%.1f), expected was (%.1f)\n",
-                       i, myParams->data.F32[i], expectedParm[i]);
-                testStatus = false;
-            } else {
-                printf("Parameter %d: (%.1f), expected was (%.1f)\n",
-                       i, myParams->data.F32[i], expectedParm[i]);
-            }
-        }
-        psFree(myCoords);
-        psFree(myParams);
-        psFree(min);
-        skip_end();
-        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
-    }
+    // XXX: Add tests with active parameter mask
 }
Index: trunk/psLib/test/math/tap_psPolyFit1D.c
===================================================================
--- trunk/psLib/test/math/tap_psPolyFit1D.c	(revision 13123)
+++ trunk/psLib/test/math/tap_psPolyFit1D.c	(revision 13124)
@@ -8,7 +8,4 @@
  
 XXX: Try null stats.
- 
-XXX: The tests with "Some Vectors NULL" fail as of 2006/12, they had passed
-previously as of 2006/02.  They are commented out for now.
  *****************************************************************************/
 #include <stdio.h>
@@ -352,14 +349,5 @@
 {
     psLogSetFormat("HLNM");
-    psTraceSetLevel(".", 0);
-    psTraceSetLevel("psVectorClipFitPolynomial1D", 0);
-    psTraceSetLevel("VectorFitPolynomial1DOrd", 0);
-    psTraceSetLevel("VectorFitPolynomial1DCheb", 0);
-    psTraceSetLevel("vectorFitPolynomial1DCheb", 0);
-    psTraceSetLevel("vectorFitPolynomial1DChebSlow", 0);
-    psTraceSetLevel("vectorFitPolynomial1DChebFast", 0);
-    psTraceSetLevel("psVectorFitPolynomial1D", 0);
-    psTraceSetLevel("p_psCreateChebyshevPolys", 0);
-
+    psLogSetLevel(PS_LOG_INFO);
     plan_tests(64);
 
@@ -368,5 +356,4 @@
     //
     // All Vectors non-NULL
-
     ok(genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F32 | TS00_F_F32 | TS00_POLY_ORD, POLY_ORDER, NUM_DATA, true), "F32 tests: Ordinary polys, non-clip fit");
     // Some Vectors NULL
@@ -382,5 +369,4 @@
     ok(genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_S32 | TS00_F_F32 | TS00_POLY_ORD, POLY_ORDER, NUM_DATA, false), "F32 tests: Ordinary polys, non-clip fit, Unallowable vector types");
     ok(genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F32 | TS00_F_S32 | TS00_POLY_ORD, POLY_ORDER, NUM_DATA, false), "F32 tests: Ordinary polys, non-clip fit, Unallowable vector types");
-
     // Mismatch vector types
     ok(genericTest(TS00_MASK_S32 | TS00_FERR_F32 | TS00_X_F32 | TS00_F_F32 | TS00_POLY_ORD, POLY_ORDER, NUM_DATA, false), "F32 tests: Ordinary polys, non-clip fit, Mismatch vector types");
@@ -392,5 +378,4 @@
     //
     // All Vectors non-NULL
-
     ok(genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F64 | TS00_F_F64 | TS00_POLY_ORD, POLY_ORDER, NUM_DATA, true), "F64 tests: Ordinary polys, non-clip fit");
     // Some Vectors NULL
Index: trunk/psLib/test/math/tap_psPolyFit2D.c
===================================================================
--- trunk/psLib/test/math/tap_psPolyFit2D.c	(revision 13123)
+++ trunk/psLib/test/math/tap_psPolyFit2D.c	(revision 13124)
@@ -363,9 +363,5 @@
 {
     psLogSetFormat("HLNM");
-    psTraceSetLevel(".", 0);
-    psTraceSetLevel("psVectorClipFitPolynomial2D", 0);
-    psTraceSetLevel("VectorFitPolynomial2DOrd", 0);
-    psTraceSetLevel("psVectorFitPolynomial2D", 0);
-
+    psLogSetLevel(PS_LOG_INFO);
     plan_tests(44);
 
Index: trunk/psLib/test/math/tap_psPolyFit3D.c
===================================================================
--- trunk/psLib/test/math/tap_psPolyFit3D.c	(revision 13123)
+++ trunk/psLib/test/math/tap_psPolyFit3D.c	(revision 13124)
@@ -413,9 +413,5 @@
 {
     psLogSetFormat("HLNM");
-    psTraceSetLevel(".", 0);
-    psTraceSetLevel("psVectorClipFitPolynomial3D", 0);
-    psTraceSetLevel("VectorFitPolynomial3DOrd", 0);
-    psTraceSetLevel("psVectorFitPolynomial3D", 0);
-
+    psLogSetLevel(PS_LOG_INFO);
     plan_tests(52);
 
Index: trunk/psLib/test/math/tap_psPolyFit4D.c
===================================================================
--- trunk/psLib/test/math/tap_psPolyFit4D.c	(revision 13123)
+++ trunk/psLib/test/math/tap_psPolyFit4D.c	(revision 13124)
@@ -471,9 +471,5 @@
 {
     psLogSetFormat("HLNM");
-    psTraceSetLevel(".", 0);
-    psTraceSetLevel("psVectorClipFitPolynomial4D", 0);
-    psTraceSetLevel("VectorFitPolynomial4DOrd", 0);
-    psTraceSetLevel("psVectorFitPolynomial4D", 0);
-
+    psLogSetLevel(PS_LOG_INFO);
     plan_tests(60);
 
Index: trunk/psLib/test/math/tap_psPolynomialEval1D.c
===================================================================
--- trunk/psLib/test/math/tap_psPolynomialEval1D.c	(revision 13123)
+++ trunk/psLib/test/math/tap_psPolynomialEval1D.c	(revision 13124)
@@ -4,6 +4,6 @@
 *  ORD and CHEB type polynomials.
 *
-*  @version  $Revision: 1.6 $  $Name: not supported by cvs2svn $
-*  @date  $Date: 2007-04-10 21:09:30 $
+*  @version  $Revision: 1.7 $  $Name: not supported by cvs2svn $
+*  @date  $Date: 2007-05-02 04:20:06 $
 *
 *  XXX: Probably should test single- and multi-dimensional polynomials in
@@ -44,5 +44,25 @@
     psLogSetFormat("HLNM");
     psLogSetLevel(PS_LOG_INFO);
-    plan_tests(24);
+    plan_tests(30);
+
+
+    // Allocate polynomial with unallowable type
+    {
+        psMemId id = psMemGetId();
+        psPolynomial1D* polyOrd = psPolynomial1DAlloc(99, TERMS-1);
+        ok(polyOrd==NULL, "psPolynomial1DAlloc() returned NULL with unallowed type");
+        psFree(polyOrd);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+
+    // Evaluate a NULL polynomial
+    {
+        psMemId id = psMemGetId();
+        psF64 result = psPolynomial1DEval(NULL, 0.0);
+        ok(isnan(result), "psPolynomial1DEval() returned NAN with NULL psPolynomial");
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
 
     // Allocate and evaluate an ordinary polynomial structure
@@ -75,5 +95,5 @@
         skip_end();
         psFree(polyOrd);
-        ok(!psMemCheckLeaks(id, NULL, NULL, false), "no memory leaks");
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     }
 
@@ -107,21 +127,4 @@
 
 
-    // Allocate polynomial with unallowable type
-    // XXX: This is wierd: why the skip()?
-    {
-        psMemId id = psMemGetId();
-        psPolynomial1D* polyOrd = psPolynomial1DAlloc(99, TERMS-1);
-        ok(polyOrd==NULL, "psPolynomial1DAlloc() returned NULL, as expected");
-        skip_start(polyOrd!=NULL, 1, "Skipping tests because psPolynomial1DAlloc() failed");
-
-        // Attempt to evaluation invalid polynomial type
-        psF64 result = psPolynomial1DEval(polyOrd, 0.0);
-        ok(isnan(result), "psPolynomial1DEval() did not return NAN, as expected");
-        skip_end();
-        psFree(polyOrd);
-        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
-    }
-
-
     // Allocate polynomial, test the psPolynomial1DEvalVector() routines
     {
@@ -162,13 +165,25 @@
         ok(!errorFlag, "psPolynomial1DEvalVector() produced the correct answers");
 
-        // Attempt to invoke function with null polynomial
-        ok(psPolynomial1DEvalVector(NULL, inputOrd) == NULL, "psPolynomial1DEvalVector() produced NULL when called with NULL polynomial");
-
-        // Attempt to invoke function with null input vector
-        ok(psPolynomial1DEvalVector(polyOrd,NULL) == NULL, "psPolynomial1DEvalVector() produced NULL when called with NULL input vector");
+        // Attempt to invoke function with NULL polynomial
+        {
+            psMemId id = psMemGetId();
+            ok(psPolynomial1DEvalVector(NULL, inputOrd) == NULL, "psPolynomial1DEvalVector() produced NULL when called with NULL polynomial");
+            ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+        }
+
+        // Attempt to invoke function with NULL input vector
+        {
+            psMemId id = psMemGetId();
+            ok(psPolynomial1DEvalVector(polyOrd, NULL) == NULL, "psPolynomial1DEvalVector() produced NULL when called with NULL input vector");
+            ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+        }
 
         // Attempt to invoke function with a non F64 type input vector
-        inputOrd->type.type = PS_TYPE_U8;
-        ok(psPolynomial1DEvalVector(polyOrd,inputOrd) == NULL, "psPolynomial1DEvalVector() produced NULL when called with non F64 input vector");
+        {
+            psMemId id = psMemGetId();
+            inputOrd->type.type = PS_TYPE_U8;
+            ok(psPolynomial1DEvalVector(polyOrd,inputOrd) == NULL, "psPolynomial1DEvalVector() produced NULL when called with non F64 input vector");
+            ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+        }
         psFree(outputOrd);
         skip_end();
@@ -216,10 +231,22 @@
         ok(!errorFlag, "psPolynomial1DEvalVector() produced the correct answers");
 
-        // Attempt to invoke function with null input vector
-        ok(psPolynomial1DEvalVector(polyCheb,NULL) == NULL, "psPolynomial1DEvalVector() produced NULL when called with NULL input vector");
+
+        // Attempt to invoke function with NULL input vector
+        {
+            psMemId id = psMemGetId();
+            ok(psPolynomial1DEvalVector(polyCheb,NULL) == NULL, "psPolynomial1DEvalVector() produced NULL when called with NULL input vector");
+            ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+        }
+
 
         // Attempt to invoke function with a non F64 type input vector
-        inputCheb->type.type = PS_TYPE_U8;
-        ok(psPolynomial1DEvalVector(polyCheb,inputCheb) == NULL, "psPolynomial1DEvalVector() produced NULL when called with non F64 input vector");
+        {
+            psMemId id = psMemGetId();
+            inputCheb->type.type = PS_TYPE_U8;
+            ok(psPolynomial1DEvalVector(polyCheb,inputCheb) == NULL, "psPolynomial1DEvalVector() produced NULL when called with non F64 input vector");
+            ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+        }
+
+
         psFree(outputCheb);
         skip_end();
Index: trunk/psLib/test/math/tap_psPolynomialEval2D.c
===================================================================
--- trunk/psLib/test/math/tap_psPolynomialEval2D.c	(revision 13123)
+++ trunk/psLib/test/math/tap_psPolynomialEval2D.c	(revision 13124)
@@ -4,6 +4,6 @@
 *  ORD and CHEB type polynomials.
 *
-*  @version  $Revision: 1.5 $  $Name: not supported by cvs2svn $
-*  @date  $Date: 2007-01-30 04:52:42 $
+*  @version  $Revision: 1.6 $  $Name: not supported by cvs2svn $
+*  @date  $Date: 2007-05-02 04:20:06 $
 *
 * Copyright 2004-2005 Maui High Performance Computing Center, Univ. of Hawaii
@@ -70,5 +70,25 @@
     psLogSetFormat("HLNM");
     psLogSetLevel(PS_LOG_INFO);
-    plan_tests(28);
+    plan_tests(40);
+
+
+    // Allocate polynomial with unallowed type
+    {
+        psMemId id = psMemGetId();
+        psPolynomial2D* polyOrd = psPolynomial2DAlloc(99, TERMS-1, TERMS-1);
+        ok(polyOrd == NULL, "psPolynomial2DAlloc() returned NULL with unallowed tpye");
+        psFree(polyOrd);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+
+    // Evaluate a NULL polynomial
+    {
+        psMemId id = psMemGetId();
+        psF64 result = psPolynomial2DEval(NULL, 0.0, 0.0);
+        ok(isnan(result), "psPolynomial2DEval() returned NAN with NULL psPolynomial");
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
 
     // Allocate and evaluate an ordinary polynomial structure
@@ -138,19 +158,4 @@
         skip_end();
         psFree(polyCheb);
-        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
-    }
-
-
-    // Allocate polynomial with unallowed type
-    {
-        psMemId id = psMemGetId();
-        psPolynomial2D* polyOrd = psPolynomial2DAlloc(99, TERMS-1, TERMS-1);
-        ok(polyOrd == NULL, "psPolynomial2DAlloc() returned NULL with unallowed tpye");
-        //        skip_start(polyOrd == NULL, 1, "Skipping tests because psPolynomial2DAlloc() failed");
-        //        // Attempt to evaluate invalid polynomial type
-        //        psF64 result = psPolynomial2DEval(polyOrd,0.0, 0.0);
-        //        ok(isnan(result), "psPolynomial2DEval() did not return NAN, as expected");
-        //        skip_end();
-        psFree(polyOrd);
         ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     }
@@ -200,21 +205,45 @@
         ok(!errorFlag, "psPolynomial2DEvalVector() produced the correct answers");
 
-        // Attempt to invoke function with null polynomial
-        ok(psPolynomial2DEvalVector(NULL, inputOrdX, inputOrdY) == NULL, "psPolynomial2DEvalVector() produced NULL when called with NULL polynomial");
-
-        // Attempt to invoke function with null input vector
-        ok(psPolynomial2DEvalVector(polyOrd,NULL,inputOrdY) == NULL, "psPolynomial2DEvalVector() produced NULL when called with NULL input vector");
-
-        // Attempt to invoke function with null input vector
-        ok(psPolynomial2DEvalVector(polyOrd,inputOrdX,NULL) == NULL, "psPolynomial2DEvalVector() produced NULL when called with NULL input vector");
-
+
+        // Attempt to invoke function with NULL polynomial
+        {
+            psMemId id = psMemGetId();
+            ok(psPolynomial2DEvalVector(NULL, inputOrdX, inputOrdY) == NULL, "psPolynomial2DEvalVector() produced NULL when called with NULL polynomial");
+            ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+        }
+
+
+        // Attempt to invoke function with NULL input vector
+        {
+            psMemId id = psMemGetId();
+            ok(psPolynomial2DEvalVector(polyOrd,NULL,inputOrdY) == NULL, "psPolynomial2DEvalVector() produced NULL when called with NULL input vector");
+            ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+        }
+
+    
+        // Attempt to invoke function with NULL input vector
+        {
+            psMemId id = psMemGetId();
+            ok(psPolynomial2DEvalVector(polyOrd,inputOrdX,NULL) == NULL, "psPolynomial2DEvalVector() produced NULL when called with NULL input vector");
+            ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+        }
+
+    
         // Attempt to invoke function with a non F64 type input vector
-        inputOrdX->type.type = PS_TYPE_U8;
-        ok(psPolynomial2DEvalVector(polyOrd,inputOrdX,inputOrdY) == NULL, "psPolynomial2DEvalVector() produced NULL when called with non F64 input vector");
+        {
+            psMemId id = psMemGetId();
+            inputOrdX->type.type = PS_TYPE_U8;
+            ok(psPolynomial2DEvalVector(polyOrd,inputOrdX,inputOrdY) == NULL, "psPolynomial2DEvalVector() produced NULL when called with non F64 input vector");
+            ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+        }
+
         inputOrdX->type.type = PS_TYPE_F64;
-
         // Attempt to invoke function with a non F64 type input vector
-        inputOrdY->type.type = PS_TYPE_U8;
-        ok(psPolynomial2DEvalVector(polyOrd,inputOrdX, inputOrdY) == NULL, "psPolynomial2DEvalVector() produced NULL when called with non F64 input vector");
+        {
+            psMemId id = psMemGetId();
+            inputOrdY->type.type = PS_TYPE_U8;
+            ok(psPolynomial2DEvalVector(polyOrd,inputOrdX, inputOrdY) == NULL, "psPolynomial2DEvalVector() produced NULL when called with non F64 input vector");
+            ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+        }
         psFree(outputOrd);
         skip_end();
@@ -227,7 +256,4 @@
 
 
-
-
-
     // Allocate polynomial, test the psPolynomial2DEvalVector() routines
     {
@@ -274,21 +300,46 @@
         ok(!errorFlag, "psPolynomial2DEvalVector() produced the correct answers");
 
-        // Attempt to invoke function with null polynomial
-        ok(psPolynomial2DEvalVector(NULL, inputChebX, inputChebY) == NULL, "psPolynomial2DEvalVector() produced NULL when called with NULL polynomial");
-
-        // Attempt to invoke function with null input vector
-        ok(psPolynomial2DEvalVector(polyCheb,NULL,inputChebY) == NULL, "psPolynomial2DEvalVector() produced NULL when called with NULL input vector");
-
-        // Attempt to invoke function with null input vector
-        ok(psPolynomial2DEvalVector(polyCheb,inputChebX,NULL) == NULL, "psPolynomial2DEvalVector() produced NULL when called with NULL input vector");
+        // Attempt to invoke function with NULL polynomial
+        {
+            psMemId id = psMemGetId();
+            ok(psPolynomial2DEvalVector(NULL, inputChebX, inputChebY) == NULL, "psPolynomial2DEvalVector() produced NULL when called with NULL polynomial");
+            ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+        }
+
+
+        // Attempt to invoke function with NULL input vector
+        {
+            psMemId id = psMemGetId();
+            ok(psPolynomial2DEvalVector(polyCheb,NULL,inputChebY) == NULL, "psPolynomial2DEvalVector() produced NULL when called with NULL input vector");
+            ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+        }
+
+
+        // Attempt to invoke function with NULL input vector
+        {
+            psMemId id = psMemGetId();
+            ok(psPolynomial2DEvalVector(polyCheb,inputChebX,NULL) == NULL, "psPolynomial2DEvalVector() produced NULL when called with NULL input vector");
+            ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+        }
+
 
         // Attempt to invoke function with a non F64 type input vector
-        inputChebX->type.type = PS_TYPE_U8;
-        ok(psPolynomial2DEvalVector(polyCheb,inputChebX,inputChebY) == NULL, "psPolynomial2DEvalVector() produced NULL when called with non F64 input vector");
+        {
+            psMemId id = psMemGetId();
+            inputChebX->type.type = PS_TYPE_U8;
+            ok(psPolynomial2DEvalVector(polyCheb,inputChebX,inputChebY) == NULL, "psPolynomial2DEvalVector() produced NULL when called with non F64 input vector");
+            ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+        }
+
+
         inputChebX->type.type = PS_TYPE_F64;
 
         // Attempt to invoke function with a non F64 type input vector
-        inputChebY->type.type = PS_TYPE_U8;
-        ok(psPolynomial2DEvalVector(polyCheb,inputChebX, inputChebY) == NULL, "psPolynomial2DEvalVector() produced NULL when called with non F64 input vector");
+        {
+            psMemId id = psMemGetId();
+            inputChebY->type.type = PS_TYPE_U8;
+            ok(psPolynomial2DEvalVector(polyCheb,inputChebX, inputChebY) == NULL, "psPolynomial2DEvalVector() produced NULL when called with non F64 input vector");
+            ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+        }
         psFree(outputCheb);
         skip_end();
Index: trunk/psLib/test/math/tap_psPolynomialEval3D.c
===================================================================
--- trunk/psLib/test/math/tap_psPolynomialEval3D.c	(revision 13123)
+++ trunk/psLib/test/math/tap_psPolynomialEval3D.c	(revision 13124)
@@ -4,6 +4,6 @@
 *  ORD and CHEB type polynomials.
 *
-*  @version  $Revision: 1.5 $  $Name: not supported by cvs2svn $
-*  @date  $Date: 2007-01-30 04:52:42 $
+*  @version  $Revision: 1.6 $  $Name: not supported by cvs2svn $
+*  @date  $Date: 2007-05-02 04:20:06 $
 *
 * Copyright 2004-2005 Maui High Performance Computing Center, Univ. of Hawaii
@@ -121,5 +121,27 @@
     psLogSetFormat("HLNM");
     psLogSetLevel(PS_LOG_INFO);
-    plan_tests(32);
+    plan_tests(44);
+
+
+    // Allocate polynomial with unallowed type
+    {
+        psMemId id = psMemGetId();
+        psPolynomial3D* polyOrd = psPolynomial3DAlloc(99, TERMS-1, TERMS-1, TERMS-1);
+        ok(polyOrd == NULL, "psPolynomial3DAlloc() returned NULL with unallowed type");
+        psFree(polyOrd);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+
+    }
+
+
+    // Evaluate NULL polynomial
+    {
+        psMemId id = psMemGetId();
+        psF64 result = psPolynomial3DEval(NULL, 0.0, 0.0, 0.0);
+        ok(isnan(result), "psPolynomial3DEval() returned NAN with NULL polynomial");
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+
+    }
+
 
     // Allocate and evaluate an ordinary polynomial structure
@@ -202,21 +224,4 @@
 
 
-
-    // Allocate polynomial with unallowed type
-    // XXX: This is odd.
-    {
-        psMemId id = psMemGetId();
-        psPolynomial3D* polyOrd = psPolynomial3DAlloc(99, TERMS-1, TERMS-1, TERMS-1);
-        ok(polyOrd == NULL, "psPolynomial3DAlloc() returned NULL with unallowed type");
-        //        skip_start(polyOrd == NULL, 1, "Skipping tests because psPolynomial3DAlloc() failed");
-        //        // Attempt to evaluation invalid polynomial type
-        //        psF64 result = psPolynomial3DEval(polyOrd,0.0, 0.0, 0.0);
-        //        ok(isnan(result), "psPolynomial3DEval() did not return NAN, as expected");
-        //        skip_end();
-        psFree(polyOrd);
-        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
-
-    }
-
     // Allocate polynomial, test the psPolynomial3DEvalVector() routines
     {
@@ -267,29 +272,63 @@
         ok(!errorFlag, "psPolynomial3DEvalVector() produced the correct answers");
 
-        // Attempt to invoke function with null polynomial
-        ok(psPolynomial3DEvalVector(NULL,inputOrdX,inputOrdY,inputOrdZ) == NULL, "psPolynomial3DEvalVector() produced NULL when called with NULL polynomial");
-
-        // Attempt to invoke function with null input vector
-        ok(psPolynomial3DEvalVector(polyOrd,NULL,inputOrdY,inputOrdZ) == NULL, "psPolynomial3DEvalVector() produced NULL when called with NULL input vector");
-
-        // Attempt to invoke function with null input vector
-        ok(psPolynomial3DEvalVector(polyOrd,inputOrdX,NULL,inputOrdZ) == NULL, "psPolynomial3DEvalVector() produced NULL when called with NULL input vector");
-
-        // Attempt to invoke function with null input vector
-        ok(psPolynomial3DEvalVector(polyOrd,inputOrdX,inputOrdY,NULL) == NULL, "psPolynomial3DEvalVector() produced NULL when called with NULL input vector");
-
-        // Attempt to invoke function with a non F64 type input vector
-        inputOrdX->type.type = PS_TYPE_U8;
-        ok(psPolynomial3DEvalVector(polyOrd,inputOrdX,inputOrdY,inputOrdZ) == NULL, "psPolynomial3DEvalVector() produced NULL when called with non F64 input vector");
+
+        // Attempt to invoke function with NULL polynomial
+        {
+            psMemId id = psMemGetId();
+            ok(psPolynomial3DEvalVector(NULL,inputOrdX,inputOrdY,inputOrdZ) == NULL, "psPolynomial3DEvalVector() produced NULL when called with NULL polynomial");
+            ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+        }
+
+
+        // Attempt to invoke function with NULL input vector
+        {
+            psMemId id = psMemGetId();
+            ok(psPolynomial3DEvalVector(polyOrd,NULL,inputOrdY,inputOrdZ) == NULL, "psPolynomial3DEvalVector() produced NULL when called with NULL input vector");
+            ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+        }
+    
+
+        // Attempt to invoke function with NULL input vector
+        {
+            psMemId id = psMemGetId();
+            ok(psPolynomial3DEvalVector(polyOrd,inputOrdX,NULL,inputOrdZ) == NULL, "psPolynomial3DEvalVector() produced NULL when called with NULL input vector");
+            ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+        }
+
+
+        // Attempt to invoke function with NULL input vector
+        {
+            psMemId id = psMemGetId();
+            ok(psPolynomial3DEvalVector(polyOrd,inputOrdX,inputOrdY,NULL) == NULL, "psPolynomial3DEvalVector() produced NULL when called with NULL input vector");
+            ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+        }
+
+
+        // Attempt to invoke function with a non F64 type input vector
+        {
+            psMemId id = psMemGetId();
+            inputOrdX->type.type = PS_TYPE_U8;
+            ok(psPolynomial3DEvalVector(polyOrd,inputOrdX,inputOrdY,inputOrdZ) == NULL, "psPolynomial3DEvalVector() produced NULL when called with non F64 input vector");
+            ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+        }
         inputOrdX->type.type = PS_TYPE_F64;
 
-        // Attempt to invoke function with a non F64 type input vector
-        inputOrdY->type.type = PS_TYPE_U8;
-        ok(psPolynomial3DEvalVector(polyOrd,inputOrdX,inputOrdY,inputOrdZ) == NULL, "psPolynomial3DEvalVector() produced NULL when called with non F64 input vector");
+
+        // Attempt to invoke function with a non F64 type input vector
+        {
+            psMemId id = psMemGetId();
+            inputOrdY->type.type = PS_TYPE_U8;
+            ok(psPolynomial3DEvalVector(polyOrd,inputOrdX,inputOrdY,inputOrdZ) == NULL, "psPolynomial3DEvalVector() produced NULL when called with non F64 input vector");
+            ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+        }
         inputOrdY->type.type = PS_TYPE_F64;
 
         // Attempt to invoke function with a non F64 type input vector
-        inputOrdZ->type.type = PS_TYPE_U8;
-        ok(psPolynomial3DEvalVector(polyOrd,inputOrdX,inputOrdY,inputOrdZ) == NULL, "psPolynomial3DEvalVector() produced NULL when called with non F64 input vector");
+        {
+            psMemId id = psMemGetId();
+            inputOrdZ->type.type = PS_TYPE_U8;
+            ok(psPolynomial3DEvalVector(polyOrd,inputOrdX,inputOrdY,inputOrdZ) == NULL, "psPolynomial3DEvalVector() produced NULL when called with non F64 input vector");
+            ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+        }
         psFree(outputOrd);
         skip_end();
@@ -302,6 +341,4 @@
 
 
-
-
     // Allocate polynomial, test the psPolynomial3DEvalVector() routines
     {
@@ -351,29 +388,63 @@
         ok(!errorFlag, "psPolynomial3DEvalVector() produced the correct answers");
 
-        // Attempt to invoke function with null polynomial
-        ok(psPolynomial3DEvalVector(NULL,inputChebX,inputChebY,inputChebZ) == NULL, "psPolynomial3DEvalVector() produced NULL when called with NULL polynomial");
-
-        // Attempt to invoke function with null input vector
-        ok(psPolynomial3DEvalVector(polyCheb,NULL,inputChebY,inputChebZ) == NULL, "psPolynomial3DEvalVector() produced NULL when called with NULL input vector");
-
-        // Attempt to invoke function with null input vector
-        ok(psPolynomial3DEvalVector(polyCheb,inputChebX,NULL,inputChebZ) == NULL, "psPolynomial3DEvalVector() produced NULL when called with NULL input vector");
-
-        // Attempt to invoke function with null input vector
-        ok(psPolynomial3DEvalVector(polyCheb,inputChebX,inputChebY,NULL) == NULL, "psPolynomial3DEvalVector() produced NULL when called with NULL input vector");
-
-        // Attempt to invoke function with a non F64 type input vector
-        inputChebX->type.type = PS_TYPE_U8;
-        ok(psPolynomial3DEvalVector(polyCheb,inputChebX,inputChebY,inputChebZ) == NULL, "psPolynomial3DEvalVector() produced NULL when called with non F64 input vector");
+        // Attempt to invoke function with NULL polynomial
+        {
+            psMemId id = psMemGetId();
+            ok(psPolynomial3DEvalVector(NULL,inputChebX,inputChebY,inputChebZ) == NULL, "psPolynomial3DEvalVector() produced NULL when called with NULL polynomial");
+            ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+        }
+
+
+        // Attempt to invoke function with NULL input vector
+        {
+            psMemId id = psMemGetId();
+            ok(psPolynomial3DEvalVector(polyCheb,NULL,inputChebY,inputChebZ) == NULL, "psPolynomial3DEvalVector() produced NULL when called with NULL input vector");
+            ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+        }
+
+
+        // Attempt to invoke function with NULL input vector
+        {
+            psMemId id = psMemGetId();
+            ok(psPolynomial3DEvalVector(polyCheb,inputChebX,NULL,inputChebZ) == NULL, "psPolynomial3DEvalVector() produced NULL when called with NULL input vector");
+            ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+        }
+
+
+        // Attempt to invoke function with NULL input vector
+        {
+            psMemId id = psMemGetId();
+            ok(psPolynomial3DEvalVector(polyCheb,inputChebX,inputChebY,NULL) == NULL, "psPolynomial3DEvalVector() produced NULL when called with NULL input vector");
+            ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+        }
+
+
+        // Attempt to invoke function with a non F64 type input vector
+        {
+            psMemId id = psMemGetId();
+            inputChebX->type.type = PS_TYPE_U8;
+            ok(psPolynomial3DEvalVector(polyCheb,inputChebX,inputChebY,inputChebZ) == NULL, "psPolynomial3DEvalVector() produced NULL when called with non F64 input vector");
+            ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+        }
         inputChebX->type.type = PS_TYPE_F64;
 
-        // Attempt to invoke function with a non F64 type input vector
-        inputChebY->type.type = PS_TYPE_U8;
-        ok(psPolynomial3DEvalVector(polyCheb,inputChebX,inputChebY,inputChebZ) == NULL, "psPolynomial3DEvalVector() produced NULL when called with non F64 input vector");
+
+        // Attempt to invoke function with a non F64 type input vector
+        {
+            psMemId id = psMemGetId();
+            inputChebY->type.type = PS_TYPE_U8;
+            ok(psPolynomial3DEvalVector(polyCheb,inputChebX,inputChebY,inputChebZ) == NULL, "psPolynomial3DEvalVector() produced NULL when called with non F64 input vector");
+            ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+        }
         inputChebY->type.type = PS_TYPE_F64;
 
-        // Attempt to invoke function with a non F64 type input vector
-        inputChebZ->type.type = PS_TYPE_U8;
-        ok(psPolynomial3DEvalVector(polyCheb,inputChebX,inputChebY,inputChebZ) == NULL, "psPolynomial3DEvalVector() produced NULL when called with non F64 input vector");
+
+        // Attempt to invoke function with a non F64 type input vector
+        {
+            psMemId id = psMemGetId();
+            inputChebZ->type.type = PS_TYPE_U8;
+            ok(psPolynomial3DEvalVector(polyCheb,inputChebX,inputChebY,inputChebZ) == NULL, "psPolynomial3DEvalVector() produced NULL when called with non F64 input vector");
+            ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+        }
         psFree(outputCheb);
         skip_end();
Index: trunk/psLib/test/math/tap_psPolynomialEval4D.c
===================================================================
--- trunk/psLib/test/math/tap_psPolynomialEval4D.c	(revision 13123)
+++ trunk/psLib/test/math/tap_psPolynomialEval4D.c	(revision 13124)
@@ -4,6 +4,6 @@
 *  ORD and CHEB type polynomials.
 *
-*  @version  $Revision: 1.4 $  $Name: not supported by cvs2svn $
-*  @date  $Date: 2007-01-30 04:49:52 $
+*  @version  $Revision: 1.5 $  $Name: not supported by cvs2svn $
+*  @date  $Date: 2007-05-02 04:20:06 $
 *
 * Copyright 2004-2005 Maui High Performance Computing Center, Univ. of Hawaii
@@ -363,5 +363,25 @@
     psLogSetFormat("HLNM");
     psLogSetLevel(PS_LOG_INFO);
-    plan_tests(37);
+    plan_tests(56);
+
+
+    // Allocate polynomial with unallowed type
+    {
+        psMemId id = psMemGetId();
+        psPolynomial4D* polyOrd = psPolynomial4DAlloc(99, TERMS-1, TERMS-1, TERMS-1, TERMS-1);
+        ok(polyOrd == NULL, "psPolynomial4DAlloc() returned NULL with unallowed type");
+        psFree(polyOrd);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+
+    // Evaluate NULL polynomial
+    {
+        psMemId id = psMemGetId();
+        psF64 result = psPolynomial4DEval(NULL, 0.0, 0.0, 0.0, 0.0);
+        ok(isnan(result), "psPolynomial4DEval() returned NAN with unallowed type");
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
 
     // Allocate and evaluate an ordinary polynomial structure
@@ -444,20 +464,4 @@
 
 
-    // XXX: This is wierd: why the skip()?
-    // Allocate polynomial with unallowed type
-    {
-        psMemId id = psMemGetId();
-        psPolynomial4D* polyOrd = psPolynomial4DAlloc(99, TERMS-1, TERMS-1, TERMS-1, TERMS-1);
-        ok(polyOrd == NULL, "Ordinary polynomial allocation successful");
-        skip_start(polyOrd == NULL, 1, "Skipping tests because psPolynomial4DAlloc() failed");
-
-        // Attempt to evaluation invalid polynomial type
-        psF64 result = psPolynomial4DEval(polyOrd,0.0, 0.0, 0.0, 0.0);
-        ok(isnan(result), "psPolynomial3DEval() did not return NAN, as expected");
-        skip_end();
-        psFree(polyOrd);
-        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
-    }
-
     // Allocate polynomial, test the psPolynomial4DEvalVector() routines
     {
@@ -514,37 +518,82 @@
         ok(!errorFlag, "psPolynomial4DEvalVector() produced the correct answers");
 
-        // Attempt to invoke function with null polynomial
-        ok(psPolynomial4DEvalVector(NULL,inputOrdW,inputOrdX,inputOrdY,inputOrdZ) == NULL, "psPolynomial4DEvalVector() produced NULL when called with NULL polynomial");
-
-        // Attempt to invoke function with null input vector
-        ok(psPolynomial4DEvalVector(polyOrd,NULL,inputOrdX,inputOrdY,inputOrdZ) == NULL, "psPolynomial4DEvalVector() produced NULL when called with NULL input vector");
-
-        // Attempt to invoke function with null input vector
-        ok(psPolynomial4DEvalVector(polyOrd,inputOrdW,NULL,inputOrdY,inputOrdZ) == NULL, "psPolynomial4DEvalVector() produced NULL when called with NULL input vector");
-
-        // Attempt to invoke function with null input vector
-        ok(psPolynomial4DEvalVector(polyOrd,inputOrdW,inputOrdX,NULL,inputOrdZ) == NULL, "psPolynomial4DEvalVector() produced NULL when called with NULL input vector");
-
-        // Attempt to invoke function with null input vector
-        ok(psPolynomial4DEvalVector(polyOrd,inputOrdW,inputOrdX,inputOrdY,NULL) == NULL, "psPolynomial4DEvalVector() produced NULL when called with NULL input vector");
+
+        // Attempt to invoke function with NULL polynomial
+        {
+            psMemId id = psMemGetId();
+            ok(psPolynomial4DEvalVector(NULL,inputOrdW,inputOrdX,inputOrdY,inputOrdZ) == NULL, "psPolynomial4DEvalVector() produced NULL when called with NULL polynomial");
+            ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+        }
+
+
+        // Attempt to invoke function with NULL input vector
+        {
+            psMemId id = psMemGetId();
+            ok(psPolynomial4DEvalVector(polyOrd,NULL,inputOrdX,inputOrdY,inputOrdZ) == NULL, "psPolynomial4DEvalVector() produced NULL when called with NULL input vector");
+            ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+        }
+
+
+        // Attempt to invoke function with NULL input vector
+        {
+            psMemId id = psMemGetId();
+            ok(psPolynomial4DEvalVector(polyOrd,inputOrdW,NULL,inputOrdY,inputOrdZ) == NULL, "psPolynomial4DEvalVector() produced NULL when called with NULL input vector");
+            ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+        }
+
+
+        // Attempt to invoke function with NULL input vector
+        {
+            psMemId id = psMemGetId();
+            ok(psPolynomial4DEvalVector(polyOrd,inputOrdW,inputOrdX,NULL,inputOrdZ) == NULL, "psPolynomial4DEvalVector() produced NULL when called with NULL input vector");
+            ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+        }
+
+
+        // Attempt to invoke function with NULL input vector
+        {
+            psMemId id = psMemGetId();
+            ok(psPolynomial4DEvalVector(polyOrd,inputOrdW,inputOrdX,inputOrdY,NULL) == NULL, "psPolynomial4DEvalVector() produced NULL when called with NULL input vector");
+            ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+        }
+
 
         // Attempt to invoke function with a non F64 type input vector
-        inputOrdX->type.type = PS_TYPE_U8;
-        ok(psPolynomial4DEvalVector(polyOrd,inputOrdW,inputOrdX,inputOrdY,inputOrdZ) == NULL, "psPolynomial4DEvalVector() produced NULL when called with non F64 input vector");
+        {
+            psMemId id = psMemGetId();
+            inputOrdX->type.type = PS_TYPE_U8;
+            ok(psPolynomial4DEvalVector(polyOrd,inputOrdW,inputOrdX,inputOrdY,inputOrdZ) == NULL, "psPolynomial4DEvalVector() produced NULL when called with non F64 input vector");
+            ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+        }
         inputOrdX->type.type = PS_TYPE_F64;
 
+
         // Attempt to invoke function with a non F64 type input vector
-        inputOrdY->type.type = PS_TYPE_U8;
-        ok(psPolynomial4DEvalVector(polyOrd,inputOrdW,inputOrdX,inputOrdY,inputOrdZ) == NULL, "psPolynomial4DEvalVector() produced NULL when called with non F64 input vector");
+        {
+            psMemId id = psMemGetId();
+            inputOrdY->type.type = PS_TYPE_U8;
+            ok(psPolynomial4DEvalVector(polyOrd,inputOrdW,inputOrdX,inputOrdY,inputOrdZ) == NULL, "psPolynomial4DEvalVector() produced NULL when called with non F64 input vector");
+            ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+        }
         inputOrdY->type.type = PS_TYPE_F64;
 
+
         // Attempt to invoke function with a non F64 type input vector
-        inputOrdZ->type.type = PS_TYPE_U8;
-        ok(psPolynomial4DEvalVector(polyOrd,inputOrdW,inputOrdX,inputOrdY,inputOrdZ) == NULL, "psPolynomial4DEvalVector() produced NULL when called with non F64 input vector");
+        {
+            psMemId id = psMemGetId();
+            inputOrdZ->type.type = PS_TYPE_U8;
+            ok(psPolynomial4DEvalVector(polyOrd,inputOrdW,inputOrdX,inputOrdY,inputOrdZ) == NULL, "psPolynomial4DEvalVector() produced NULL when called with non F64 input vector");
+            ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+        }
         inputOrdZ->type.type = PS_TYPE_F64;
 
+
         // Attempt to invoke function with a non F64 type input vector
-        inputOrdW->type.type = PS_TYPE_U8;
-        ok(psPolynomial4DEvalVector(polyOrd,inputOrdW,inputOrdX,inputOrdY,inputOrdZ) == NULL, "psPolynomial4DEvalVector() produced NULL when called with non F64 input vector");
+        {
+            psMemId id = psMemGetId();
+            inputOrdW->type.type = PS_TYPE_U8;
+            ok(psPolynomial4DEvalVector(polyOrd,inputOrdW,inputOrdX,inputOrdY,inputOrdZ) == NULL, "psPolynomial4DEvalVector() produced NULL when called with non F64 input vector");
+            ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+        }
         inputOrdW->type.type = PS_TYPE_F64;
         psFree(outputOrd);
@@ -613,37 +662,82 @@
         ok(!errorFlag, "psPolynomial4DEvalVector() produced the correct answers");
 
-        // Attempt to invoke function with null polynomial
-        ok(psPolynomial4DEvalVector(NULL,inputChebW,inputChebX,inputChebY,inputChebZ) == NULL, "psPolynomial4DEvalVector() produced NULL when called with NULL polynomial");
-
-        // Attempt to invoke function with null input vector
-        ok(psPolynomial4DEvalVector(polyCheb,NULL,inputChebX,inputChebY,inputChebZ) == NULL, "psPolynomial4DEvalVector() produced NULL when called with NULL input vector");
-
-        // Attempt to invoke function with null input vector
-        ok(psPolynomial4DEvalVector(polyCheb,inputChebW,NULL,inputChebY,inputChebZ) == NULL, "psPolynomial4DEvalVector() produced NULL when called with NULL input vector");
-
-        // Attempt to invoke function with null input vector
-        ok(psPolynomial4DEvalVector(polyCheb,inputChebW,inputChebX,NULL,inputChebZ) == NULL, "psPolynomial4DEvalVector() produced NULL when called with NULL input vector");
-
-        // Attempt to invoke function with null input vector
-        ok(psPolynomial4DEvalVector(polyCheb,inputChebW,inputChebX,inputChebY,NULL) == NULL, "psPolynomial4DEvalVector() produced NULL when called with NULL input vector");
+
+        // Attempt to invoke function with NULL polynomial
+        {
+            psMemId id = psMemGetId();
+            ok(psPolynomial4DEvalVector(NULL,inputChebW,inputChebX,inputChebY,inputChebZ) == NULL, "psPolynomial4DEvalVector() produced NULL when called with NULL polynomial");
+            ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+        }
+
+
+        // Attempt to invoke function with NULL input vector
+        {
+            psMemId id = psMemGetId();
+            ok(psPolynomial4DEvalVector(polyCheb,NULL,inputChebX,inputChebY,inputChebZ) == NULL, "psPolynomial4DEvalVector() produced NULL when called with NULL input vector");
+            ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+        }
+
+
+        // Attempt to invoke function with NULL input vector
+        {
+            psMemId id = psMemGetId();
+            ok(psPolynomial4DEvalVector(polyCheb,inputChebW,NULL,inputChebY,inputChebZ) == NULL, "psPolynomial4DEvalVector() produced NULL when called with NULL input vector");
+            ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+        }
+
+
+        // Attempt to invoke function with NULL input vector
+        {
+            psMemId id = psMemGetId();
+            ok(psPolynomial4DEvalVector(polyCheb,inputChebW,inputChebX,NULL,inputChebZ) == NULL, "psPolynomial4DEvalVector() produced NULL when called with NULL input vector");
+            ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+        }
+
+
+        // Attempt to invoke function with NULL input vector
+        {
+            psMemId id = psMemGetId();
+            ok(psPolynomial4DEvalVector(polyCheb,inputChebW,inputChebX,inputChebY,NULL) == NULL, "psPolynomial4DEvalVector() produced NULL when called with NULL input vector");
+            ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+        }
+
 
         // Attempt to invoke function with a non F64 type input vector
-        inputChebX->type.type = PS_TYPE_U8;
-        ok(psPolynomial4DEvalVector(polyCheb,inputChebW,inputChebX,inputChebY,inputChebZ) == NULL, "psPolynomial4DEvalVector() produced NULL when called with non F64 input vector");
+        {
+            psMemId id = psMemGetId();
+            inputChebX->type.type = PS_TYPE_U8;
+            ok(psPolynomial4DEvalVector(polyCheb,inputChebW,inputChebX,inputChebY,inputChebZ) == NULL, "psPolynomial4DEvalVector() produced NULL when called with non F64 input vector");
+            ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+        }
         inputChebX->type.type = PS_TYPE_F64;
 
+
         // Attempt to invoke function with a non F64 type input vector
-        inputChebY->type.type = PS_TYPE_U8;
-        ok(psPolynomial4DEvalVector(polyCheb,inputChebW,inputChebX,inputChebY,inputChebZ) == NULL, "psPolynomial4DEvalVector() produced NULL when called with non F64 input vector");
+        {
+            psMemId id = psMemGetId();
+            inputChebY->type.type = PS_TYPE_U8;
+            ok(psPolynomial4DEvalVector(polyCheb,inputChebW,inputChebX,inputChebY,inputChebZ) == NULL, "psPolynomial4DEvalVector() produced NULL when called with non F64 input vector");
+            ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+        }
         inputChebY->type.type = PS_TYPE_F64;
 
+
         // Attempt to invoke function with a non F64 type input vector
-        inputChebZ->type.type = PS_TYPE_U8;
-        ok(psPolynomial4DEvalVector(polyCheb,inputChebW,inputChebX,inputChebY,inputChebZ) == NULL, "psPolynomial4DEvalVector() produced NULL when called with non F64 input vector");
+        {
+            psMemId id = psMemGetId();
+            inputChebZ->type.type = PS_TYPE_U8;
+            ok(psPolynomial4DEvalVector(polyCheb,inputChebW,inputChebX,inputChebY,inputChebZ) == NULL, "psPolynomial4DEvalVector() produced NULL when called with non F64 input vector");
+            ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+        }
         inputChebZ->type.type = PS_TYPE_F64;
 
+
         // Attempt to invoke function with a non F64 type input vector
-        inputChebW->type.type = PS_TYPE_U8;
-        ok(psPolynomial4DEvalVector(polyCheb,inputChebW,inputChebX,inputChebY,inputChebZ) == NULL, "psPolynomial4DEvalVector() produced NULL when called with non F64 input vector");
+        {
+            psMemId id = psMemGetId();
+            inputChebW->type.type = PS_TYPE_U8;
+            ok(psPolynomial4DEvalVector(polyCheb,inputChebW,inputChebX,inputChebY,inputChebZ) == NULL, "psPolynomial4DEvalVector() produced NULL when called with non F64 input vector");
+            ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+        }
         inputChebW->type.type = PS_TYPE_F64;
         psFree(outputCheb);
Index: trunk/psLib/test/math/tap_psSparse.c
===================================================================
--- trunk/psLib/test/math/tap_psSparse.c	(revision 13123)
+++ trunk/psLib/test/math/tap_psSparse.c	(revision 13124)
@@ -1,3 +1,3 @@
-#include <stdio.h>
+    #include <stdio.h>
 #include <string.h>
 #include <pslib.h>
@@ -6,14 +6,38 @@
 #include "pstap.h"
 
-int main (void)
+int main(void)
 {
-    plan_tests(26);
+    psLogSetFormat("HLNM");
+    psLogSetLevel(PS_LOG_INFO);
+    plan_tests(40);
+
+
+    // test psSparseAlloc()
+    {
+        psMemId id = psMemGetId();
+        psSparse *matrix = psSparseAlloc(10, 20);
+        ok(matrix != NULL, "psSparse successfully allocated");
+        skip_start(matrix == NULL, 12, "skipping tests because psSparseAlloc() returned NULL");
+        ok(matrix->Aij != NULL, "psSparseAlloc() set ->Aij correctly");
+        ok(matrix->Aij->n == 0, "psSparseAlloc() set ->Aij->n correctly");
+        ok(matrix->Si != NULL, "psSparseAlloc() set ->Si correctly");
+        ok(matrix->Si->n == 0, "psSparseAlloc() set ->Si->n correctly");
+        ok(matrix->Sj != NULL, "psSparseAlloc() set ->Sj correctly");
+        ok(matrix->Sj->n == 0, "psSparseAlloc() set ->Sj->n correctly");
+        ok(matrix->Bfj != NULL, "psSparseAlloc() set ->Bfj correctly");
+        ok(matrix->Bfj->n == 10, "psSparseAlloc() set ->Bfj->n correctly");
+        ok(matrix->Qii != NULL, "psSparseAlloc() set ->Qii correctly");
+        ok(matrix->Qii->n == 10, "psSparseAlloc() set ->Qii->n correctly");
+        ok(matrix->Nelem == 0, "psSparseAlloc() set ->Nelem correctly");
+        ok(matrix->Nrows == 10, "psSparseAlloc() set ->Nrows correctly");
+        skip_end();
+        psFree(matrix);
+        ok(!psMemCheckLeaks(id, NULL, NULL, false), "no memory leaks");
+    }
+
 
     // test psSparseSolve for a simple normal example matrix
     {
         psMemId id = psMemGetId();
-
-        //solve a normalized matrix equation with psSparseSolve
-
         // the basic equation is Ax = b
 
@@ -22,12 +46,12 @@
         // Ax = b for x using psSparseSolve.  compare with the input values for x.
 
-        psSparse *matrix = psSparseAlloc (100, 100);
+        psSparse *matrix = psSparseAlloc(100, 100);
         ok(matrix != NULL, "psSparse successfully allocated");
         skip_start(matrix == NULL, 5, "Skipping tests because psSparseAlloc() failed");
 
-        for (int i = 0; i < 100; i++) {
-            psSparseMatrixElement (matrix, i, i, 1.0);
+        for(int i = 0; i < 100; i++) {
+            psSparseMatrixElement(matrix, i, i, 1.0);
             if (i + 1 < 100) {
-                psSparseMatrixElement (matrix, i + 1, i, 0.1);
+                psSparseMatrixElement(matrix, i + 1, i, 0.1);
             }
         }
@@ -37,7 +61,6 @@
         psSparseResort(matrix);
 
-        psVector *xRef = psVectorAlloc (100, PS_TYPE_F32);
-        for (int i = 0; i < 100; i++)
-        {
+        psVector *xRef = psVectorAlloc(100, PS_TYPE_F32);
+        for (int i = 0; i < 100; i++) {
             xRef->data.F32[i] = 1.0;
         }
@@ -60,23 +83,22 @@
         float dS = 0;
         float dS2 = 0;
-        for (int i = 0; i < 100; i++)
-        {
+        for (int i = 0; i < 100; i++) {
             float dX = xRef->data.F32[i] - xFit->data.F32[i];
-            // fprintf (stderr, "%5.3f %5.3f %5.3f %5.3f\n", bVec->data.F32[i], xRef->data.F32[i], xFit->data.F32[i], dX);
+            // fprintf(stderr, "%5.3f %5.3f %5.3f %5.3f\n", bVec->data.F32[i], xRef->data.F32[i], xFit->data.F32[i], dX);
             dS2 += PS_SQR(dX);
             dS += dX;
         }
         dS /= 100.0;
-        dS2 = sqrt (dS2/100.0 - dS*dS);
-
-        is_float_tol (dS2, 0.0, 1e-4, "scatter: %.20f", dS2);
-
-        psFree (matrix);
-        psFree (xRef);
-        psFree (bVec);
-        psFree (xFit);
-
-        skip_end();
-        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+        dS2 = sqrt(dS2/100.0 - dS*dS);
+
+        is_float_tol(dS2, 0.0, 1e-4, "scatter: %.20f", dS2);
+
+        psFree(matrix);
+        psFree(xRef);
+        psFree(bVec);
+        psFree(xFit);
+
+        skip_end();
+        ok(!psMemCheckLeaks(id, NULL, NULL, false), "no memory leaks");
     }
 
@@ -84,19 +106,18 @@
     {
         psMemId id = psMemGetId();
-
-        //solve a non-normalized matrix equation with psSparseSolve
         // the basic equation is Ax = b
+
         // create a matrix A with diagonals of 1 and a small number of off diagonal elements.
         // construct a vector x, construct the corresponding vector b by multiplication. solve
         // Ax = b for x using psSparseSolve.  compare with the input values for x.
 
-        psSparse *matrix = psSparseAlloc (100, 100);
+        psSparse *matrix = psSparseAlloc(100, 100);
         ok(matrix != NULL, "psSparse successfully allocated");
         skip_start(matrix == NULL, 5, "Skipping tests because psSparseAlloc() failed");
 
         for (int i = 0; i < 100; i++) {
-            psSparseMatrixElement (matrix, i, i, 5.0);
+            psSparseMatrixElement(matrix, i, i, 5.0);
             if (i + 1 < 100) {
-                psSparseMatrixElement (matrix, i + 1, i, 0.1);
+                psSparseMatrixElement(matrix, i + 1, i, 0.1);
             }
         }
@@ -106,7 +127,6 @@
         psSparseResort(matrix);
 
-        psVector *xRef = psVectorAlloc (100, PS_TYPE_F32);
-        for (int i = 0; i < 100; i++)
-        {
+        psVector *xRef = psVectorAlloc(100, PS_TYPE_F32);
+        for (int i = 0; i < 100; i++) {
             xRef->data.F32[i] = 1.0;
         }
@@ -123,5 +143,5 @@
         constraint.paramDelta = 1e8;
 
-        // solve for normalization terms (need include local sky?)
+        // solve for normalization terms(need include local sky?)
         psVector *xFit = psSparseSolve(NULL, constraint, matrix, 4);
 
@@ -129,23 +149,22 @@
         float dS = 0;
         float dS2 = 0;
-        for (int i = 0; i < 100; i++)
-        {
+        for (int i = 0; i < 100; i++) {
             float dX = xRef->data.F32[i] - xFit->data.F32[i];
-            // fprintf (stderr, "%5.3f %5.3f %5.3f %5.3f\n", bVec->data.F32[i], xRef->data.F32[i], xFit->data.F32[i], dX);
+            // fprintf(stderr, "%5.3f %5.3f %5.3f %5.3f\n", bVec->data.F32[i], xRef->data.F32[i], xFit->data.F32[i], dX);
             dS2 += PS_SQR(dX);
             dS += dX;
         }
         dS /= 100.0;
-        dS2 = sqrt (dS2/100.0 - dS*dS);
-
-        is_float_tol (dS2, 0.0, 1e-4, "scatter: %.20f", dS2);
-
-        psFree (matrix);
-        psFree (xRef);
-        psFree (bVec);
-        psFree (xFit);
-
-        skip_end();
-        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+        dS2 = sqrt(dS2/100.0 - dS*dS);
+
+        is_float_tol(dS2, 0.0, 1e-4, "scatter: %.20f", dS2);
+
+        psFree(matrix);
+        psFree(xRef);
+        psFree(bVec);
+        psFree(xFit);
+
+        skip_end();
+        ok(!psMemCheckLeaks(id, NULL, NULL, false), "no memory leaks");
     }
 
@@ -164,8 +183,5 @@
     {
         psMemId id = psMemGetId();
-
-        //solve a simple, small matrix equation
-
-        // the basic equation (Ax = b) is:
+        // the basic equation(Ax = b) is:
         // |S B'||x| = |f|
         // |B Q ||y| = |g|
@@ -180,5 +196,5 @@
 
         // construct the sparse matrix
-        psSparse *matrix = psSparseAlloc (Nrows, Nrows);
+        psSparse *matrix = psSparseAlloc(Nrows, Nrows);
         ok(matrix != NULL, "psSparse successfully allocated");
         skip_start(matrix == NULL, 5, "Skipping tests because psSparseAlloc() failed");
@@ -190,18 +206,18 @@
 
         // border region has a width of 1:
-        psSparseBorder *border = psSparseBorderAlloc (matrix, Nborder);
+        psSparseBorder *border = psSparseBorderAlloc(matrix, Nborder);
 
         // construct the B component:
-        psSparseBorderElementB (border, 0, 0, 0.1);
-        psSparseBorderElementB (border, 1, 0, 0.2);
+        psSparseBorderElementB(border, 0, 0, 0.1);
+        psSparseBorderElementB(border, 1, 0, 0.2);
 
         // construct the T component:
-        psSparseBorderElementT (border, 0, 0, 0.5);
+        psSparseBorderElementT(border, 0, 0, 0.5);
 
         // construct the X and Y vectors:
-        psVector *xRef = psVectorAlloc (Nrows, PS_TYPE_F32);
+        psVector *xRef = psVectorAlloc(Nrows, PS_TYPE_F32);
         xRef->data.F32[0] = 1.0;
         xRef->data.F32[1] = 1.0;
-        psVector *yRef = psVectorAlloc (Nborder, PS_TYPE_F32);
+        psVector *yRef = psVectorAlloc(Nborder, PS_TYPE_F32);
         yRef->data.F32[0] = 0.5;
 
@@ -210,28 +226,28 @@
 
         // test the support functions: LowerProduct
-        fVec = psSparseBorderLowerProduct (NULL, border, xRef);
-        is_float (fVec->n, 1.0, "f dimen: %d", fVec->n);
-        is_float (fVec->data.F32[0], 0.3, "f(0): %f", fVec->data.F32[0]);
-        psFree (fVec);
+        fVec = psSparseBorderLowerProduct(NULL, border, xRef);
+        is_float(fVec->n, 1.0, "f dimen: %d", fVec->n);
+        is_float(fVec->data.F32[0], 0.3, "f(0): %f", fVec->data.F32[0]);
+        psFree(fVec);
 
         // test the support functions: Upper Product
-        fVec = psSparseBorderUpperProduct (NULL, border, yRef);
-        is_float (fVec->n, 2.0, "f dimen: %d", fVec->n);
-        is_float (fVec->data.F32[0], 0.05, "f(0): %f", fVec->data.F32[0]);
-        is_float (fVec->data.F32[1], 0.10, "f(0): %f", fVec->data.F32[1]);
-        psFree (fVec);
+        fVec = psSparseBorderUpperProduct(NULL, border, yRef);
+        is_float(fVec->n, 2.0, "f dimen: %d", fVec->n);
+        is_float(fVec->data.F32[0], 0.05, "f(0): %f", fVec->data.F32[0]);
+        is_float(fVec->data.F32[1], 0.10, "f(0): %f", fVec->data.F32[1]);
+        psFree(fVec);
 
         // test the support functions: Square Product
-        fVec = psSparseBorderSquareProduct (NULL, border, yRef);
-        is_float (fVec->n, 1.0, "f dimen: %d", fVec->n);
-        is_float (fVec->data.F32[0], 0.25, "f(0): %f", fVec->data.F32[0]);
-        psFree (fVec);
+        fVec = psSparseBorderSquareProduct(NULL, border, yRef);
+        is_float(fVec->n, 1.0, "f dimen: %d", fVec->n);
+        is_float(fVec->data.F32[0], 0.25, "f(0): %f", fVec->data.F32[0]);
+        psFree(fVec);
 
         fVec = NULL;
         psVector *gVec = NULL;
-        psSparseBorderMultiply (&fVec, &gVec, border, xRef, yRef);
-        is_float (fVec->data.F32[0], 1.15, "f(0): %f", fVec->data.F32[0]);
-        is_float (fVec->data.F32[1], 1.20, "f(1): %f", fVec->data.F32[1]);
-        is_float (gVec->data.F32[0], 0.55, "g(0): %f", gVec->data.F32[0]);
+        psSparseBorderMultiply(&fVec, &gVec, border, xRef, yRef);
+        is_float(fVec->data.F32[0], 1.15, "f(0): %f", fVec->data.F32[0]);
+        is_float(fVec->data.F32[1], 1.20, "f(1): %f", fVec->data.F32[1]);
+        is_float(gVec->data.F32[0], 0.55, "g(0): %f", gVec->data.F32[0]);
 
         // supply the fVec and gVec data to the border
@@ -253,18 +269,18 @@
         psVector *yFit = NULL;
         psSparseBorderSolve(&xFit, &yFit, constraint, border, 4);
-        is_float_tol (xFit->data.F32[0], 1.0, 1e-4, "f(0): %f", xFit->data.F32[0]);
-        is_float_tol (xFit->data.F32[1], 1.0, 1e-4, "f(1): %f", xFit->data.F32[1]);
-        is_float_tol (yFit->data.F32[0], 0.5, 1e-4, "g(0): %f", yFit->data.F32[0]);
-
-        psFree (xFit);
-        psFree (yFit);
-        psFree (fVec);
-        psFree (gVec);
-        psFree (xRef);
-        psFree (yRef);
-        psFree (border);
-        psFree (matrix);
-        skip_end();
-        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+        is_float_tol(xFit->data.F32[0], 1.0, 1e-4, "f(0): %f", xFit->data.F32[0]);
+        is_float_tol(xFit->data.F32[1], 1.0, 1e-4, "f(1): %f", xFit->data.F32[1]);
+        is_float_tol(yFit->data.F32[0], 0.5, 1e-4, "g(0): %f", yFit->data.F32[0]);
+
+        psFree(xFit);
+        psFree(yFit);
+        psFree(fVec);
+        psFree(gVec);
+        psFree(xRef);
+        psFree(yRef);
+        psFree(border);
+        psFree(matrix);
+        skip_end();
+        ok(!psMemCheckLeaks(id, NULL, NULL, false), "no memory leaks");
     }
 
@@ -272,8 +288,5 @@
     {
         psMemId id = psMemGetId();
-
-        // solve a simple, small matrix equation
-
-        // the basic equation (Ax = b) is:
+        // the basic equation(Ax = b) is:
         // |S B'||x| = |f|
         // |B Q ||y| = |g|
@@ -288,5 +301,5 @@
 
         // construct the sparse matrix
-        psSparse *matrix = psSparseAlloc (Nrows, Nrows);
+        psSparse *matrix = psSparseAlloc(Nrows, Nrows);
         ok(matrix != NULL, "psSparse successfully allocated");
         skip_start(matrix == NULL, 5, "Skipping tests because psSparseAlloc() failed");
@@ -301,11 +314,10 @@
 
         // border region has a width of 1:
-        psSparseBorder *border = psSparseBorderAlloc (matrix, Nborder);
+        psSparseBorder *border = psSparseBorderAlloc(matrix, Nborder);
 
         // construct the B component:
-        for (int i = 0; i < Nrows; i++)
-        {
+        for (int i = 0; i < Nrows; i++) {
             for (int j = 0; j < Nborder; j++) {
-                psSparseBorderElementB (border, i, j, 0.1);
+                psSparseBorderElementB(border, i, j, 0.1);
             }
         }
@@ -313,20 +325,17 @@
 
         // construct the Q component:
-        for (int i = 0; i < Nborder; i++)
-        {
+        for (int i = 0; i < Nborder; i++) {
             for (int j = 0; j < Nborder; j++) {
-                psSparseBorderElementT (border, i, j, i+j+2);
+                psSparseBorderElementT(border, i, j, i+j+2);
             }
         }
 
         // construct the X and Y vectors:
-        psVector *xRef = psVectorAlloc (Nrows, PS_TYPE_F32);
-        for (int i = 0; i < Nrows; i++)
-        {
+        psVector *xRef = psVectorAlloc(Nrows, PS_TYPE_F32);
+        for (int i = 0; i < Nrows; i++) {
             xRef->data.F32[i] = 1.0;
         }
-        psVector *yRef = psVectorAlloc (Nborder, PS_TYPE_F32);
-        for (int i = 0; i < Nborder; i++)
-        {
+        psVector *yRef = psVectorAlloc(Nborder, PS_TYPE_F32);
+        for (int i = 0; i < Nborder; i++) {
             yRef->data.F32[i] = 1.0;
         }
@@ -335,5 +344,5 @@
         psVector *fVec = NULL;
         psVector *gVec = NULL;
-        psSparseBorderMultiply (&fVec, &gVec, border, xRef, yRef);
+        psSparseBorderMultiply(&fVec, &gVec, border, xRef, yRef);
 
         // supply the fVec and gVec data to the border
@@ -351,5 +360,5 @@
         constraint.paramDelta = 1e8;
 
-        // solve for normalization terms (need include local sky?)
+        // solve for normalization terms(need include local sky?)
         psVector *xFit = NULL;
         psVector *yFit = NULL;
@@ -359,33 +368,30 @@
         float dS = 0;
         float dS2 = 0;
-        for (int i = 0; i < Nrows; i++)
-        {
+        for (int i = 0; i < Nrows; i++) {
             float dX = xRef->data.F32[i] - xFit->data.F32[i];
-            // fprintf (stderr, "%5.3f %5.3f %5.3f %5.3f\n", fVec->data.F32[i], xRef->data.F32[i], xFit->data.F32[i], dX);
+            // fprintf(stderr, "%5.3f %5.3f %5.3f %5.3f\n", fVec->data.F32[i], xRef->data.F32[i], xFit->data.F32[i], dX);
             dS2 += PS_SQR(dX);
             dS += dX;
         }
         dS /= Nrows;
-        dS2 = sqrt (dS2/Nrows - dS*dS);
-        is_float_tol (dS2, 0.0, 1e-4, "scatter: %.20f", dS2);
+        dS2 = sqrt(dS2/Nrows - dS*dS);
+        is_float_tol(dS2, 0.0, 1e-4, "scatter: %.20f", dS2);
 
         // measure stdev between yFit and yRef
         float dY = yRef->data.F32[0] - yFit->data.F32[0];
-        // fprintf (stderr, "%5.3f %5.3f %5.3f %5.3f\n", gVec->data.F32[0], yRef->data.F32[0], yFit->data.F32[0], dS);
-        is_float_tol (dY, 0.0, 2e-4, "scatter: %.20f", dY);
-
-        psFree (xRef);
-        psFree (yRef);
-        psFree (xFit);
-        psFree (yFit);
-        psFree (fVec);
-        psFree (gVec);
-        psFree (matrix);
-        psFree (border);
-
-        skip_end();
-        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
-    }
-
-    return exit_status();
+        // fprintf(stderr, "%5.3f %5.3f %5.3f %5.3f\n", gVec->data.F32[0], yRef->data.F32[0], yFit->data.F32[0], dS);
+        is_float_tol(dY, 0.0, 2e-4, "scatter: %.20f", dY);
+
+        psFree(xRef);
+        psFree(yRef);
+        psFree(xFit);
+        psFree(yFit);
+        psFree(fVec);
+        psFree(gVec);
+        psFree(matrix);
+        psFree(border);
+
+        skip_end();
+        ok(!psMemCheckLeaks(id, NULL, NULL, false), "no memory leaks");
+    }
 }
Index: trunk/psLib/test/math/tap_psSpline1D.c
===================================================================
--- trunk/psLib/test/math/tap_psSpline1D.c	(revision 13123)
+++ trunk/psLib/test/math/tap_psSpline1D.c	(revision 13124)
@@ -13,6 +13,6 @@
 *  @author GLG, MHPCC
 *
-*  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2007-01-06 00:48:54 $
+*  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2007-05-02 04:20:06 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -257,6 +257,6 @@
     psLogSetFormat("HLNM");
     psLogSetLevel( PS_LOG_INFO );
-
-    plan_tests(24);
+    plan_tests(28);
+
     // psSplineAllocTest()
     {
@@ -270,5 +270,4 @@
         ok(tmpSpline->p_psDeriv2 == NULL, "psSpline1DAlloc() properly set the psSpline1D->p_psDeriv2 member");
         psFree(tmpSpline);
-
         skip_end();
         ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
@@ -282,4 +281,40 @@
         ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     }
+
+    // Verify psSpline1DEval() for NULL input
+    // Verify with spline->n==0, and spline->knots PS_TYPE_F64
+    {
+        psMemId id = psMemGetId();
+        float y = psSpline1DEval(NULL, 0.0);
+        ok(isnan(y), "psSpline1DEval() returned NAN will NULL input spline");
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+
+    // Verify psSpline1DEvalVector() for NULL input spline
+    {
+        psMemId id = psMemGetId();
+        psVector *x = psVectorAlloc(10, PS_TYPE_F32);
+        psVector *y = psSpline1DEvalVector(NULL, x);
+        ok(y == NULL, "psSpline1DEvalVector() returned NAN will NULL input spline");
+        psFree(x);
+        psFree(y);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+
+    // Verify psSpline1DEvalVector() for NULL input vector
+    // XXX: Move this where we have a good spline.  It currently fails because
+    // were calling it with an un-fully-allocated one.
+    if (0) {
+        psMemId id = psMemGetId();
+        psSpline1D *tmpSpline = psSpline1DAlloc();
+        psVector *y = psSpline1DEvalVector(tmpSpline, NULL);
+        ok(y == NULL, "psSpline1DEvalVector() returned NAN will NULL input vector");
+        psFree(tmpSpline);
+        psFree(y);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
 
     ok(genericF32Test(1, myFunc00, false), "Generic, simple mapping, F32 test. 1 spline");
