Index: trunk/psLib/test/dataManip/tst_psFunc02.c
===================================================================
--- trunk/psLib/test/dataManip/tst_psFunc02.c	(revision 1811)
+++ trunk/psLib/test/dataManip/tst_psFunc02.c	(revision 1946)
@@ -1,7 +1,6 @@
 /*****************************************************************************
     This routine must ensure that the psSpline1DAlloc() function properly
-    allocates the spline data structure.
- 
-    XXX: figure out the memory deallocator
+    allocates the spline data structure.  It allocates both linear and cubic
+    splines with a variety of min/max ranges.
  *****************************************************************************/
 #include <stdio.h>
@@ -11,5 +10,7 @@
 #include "psFunctions.h"
 
-#define N 10
+#define N 4
+#define LINEAR 1
+#define CUBIC 3
 
 int main()
@@ -18,5 +19,5 @@
     int memLeaks=0;
     int i;
-    //    int  currentId = psMemGetId();
+    int  currentId = psMemGetId();
     psSpline1D *tmpSpline;
 
@@ -26,61 +27,61 @@
     printPositiveTestHeader(stdout,
                             "psFunction functions",
-                            "psSpline1DAlloc()");
-
-    tmpSpline = psSpline1DAlloc(N, 1, 1.0, 10.0);
-    if (tmpSpline == NULL) {
-        printf("ERROR: Could not allocate psSpline1D data structure\n");
-        testStatus = false;
-    }
-    if (tmpSpline->spline == NULL) {
-        printf("ERROR: Could not allocate psSpline1D->spline data structure\n");
-        testStatus = false;
-    }
-
-    if (tmpSpline->n != N) {
-        printf("ERROR: spline->n set incorrectly (%d)\n", tmpSpline->n);
-        testStatus = false;
-    }
-
-    for (i=0;i<N;i++) {
-        if (tmpSpline->spline[i] == NULL) {
-            printf("ERROR: Could not allocate spline %d\n", i);
-            testStatus = false;
-        }
-        if ((tmpSpline->spline[i])->n != 2) {
-            printf("ERROR: Spline created with order %d\n", (tmpSpline->spline[i])->n);
-            testStatus = false;
-        }
-    }
-
-    if (tmpSpline->domains == NULL) {
-        printf("ERROR: Could not allocate psSpline1D->domains data structure\n");
-        testStatus = false;
-    }
-
-    for (i=0;i<N+1;i++) {
-        printf("psSpline1D->domains[%d] is %f\n", i, tmpSpline->domains[i]);
-    }
-
-    psFree(tmpSpline);
-    psMemCheckCorruption(1);
-    //    memLeaks = psMemCheckLeaks(currentId,NULL,stderr);
-    if (0 != memLeaks) {
-        psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
-    }
-
-    printFooter(stdout,
-                "psFunctions functions",
-                "psSpline1DAlloc()",
-                testStatus);
-
-    /****************************************************************************/
-    /****************************************************************************/
-    testStatus = true;
-    printPositiveTestHeader(stdout,
-                            "psFunction functions",
-                            "psSpline1DAlloc()");
-
-    tmpSpline = psSpline1DAlloc(N, 1, 1.0, 1.0);
+                            "psSpline1DAlloc(): linear, normal");
+
+    tmpSpline = psSpline1DAlloc(N, LINEAR, 1.0, 10.0);
+    if (tmpSpline == NULL) {
+        printf("ERROR: Could not allocate psSpline1D data structure\n");
+        testStatus = false;
+    }
+    if (tmpSpline->spline == NULL) {
+        printf("ERROR: Could not allocate psSpline1D->spline data structure\n");
+        testStatus = false;
+    }
+
+    if (tmpSpline->n != N) {
+        printf("ERROR: spline->n set incorrectly (%d)\n", tmpSpline->n);
+        testStatus = false;
+    }
+
+    for (i=0;i<N;i++) {
+        if (tmpSpline->spline[i] == NULL) {
+            printf("ERROR: Could not allocate spline %d\n", i);
+            testStatus = false;
+        }
+        if ((tmpSpline->spline[i])->n != LINEAR+1) {
+            printf("ERROR: Spline created with order %d\n", (tmpSpline->spline[i])->n);
+            testStatus = false;
+        }
+    }
+
+    if (tmpSpline->domains == NULL) {
+        printf("ERROR: Could not allocate psSpline1D->domains data structure\n");
+        testStatus = false;
+    }
+
+    for (i=0;i<N+1;i++) {
+        printf("psSpline1D->domains[%d] is %f\n", i, tmpSpline->domains[i]);
+    }
+
+    p_psSpline1DFree(tmpSpline);
+    psMemCheckCorruption(1);
+    memLeaks = psMemCheckLeaks(currentId,NULL,stderr);
+    if (0 != memLeaks) {
+        psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
+    }
+
+    printFooter(stdout,
+                "psFunctions functions",
+                "psSpline1DAlloc(): linear, normal",
+                testStatus);
+
+    /****************************************************************************/
+    /****************************************************************************/
+    testStatus = true;
+    printPositiveTestHeader(stdout,
+                            "psFunction functions",
+                            "psSpline1DAlloc(): linear, min/max are equal");
+
+    tmpSpline = psSpline1DAlloc(N, LINEAR, 1.0, 1.0);
 
     if (tmpSpline != NULL) {
@@ -89,132 +90,132 @@
     }
 
-    psFree(tmpSpline);
-    psMemCheckCorruption(1);
-    //    memLeaks = psMemCheckLeaks(currentId,NULL,stderr);
-    if (0 != memLeaks) {
-        psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
-    }
-
-    printFooter(stdout,
-                "psFunctions functions",
-                "psSpline1DAlloc()",
-                testStatus);
-
-    /****************************************************************************/
-    /****************************************************************************/
-    testStatus = true;
-    printPositiveTestHeader(stdout,
-                            "psFunction functions",
-                            "psSpline1DAlloc()");
-
-    tmpSpline = psSpline1DAlloc(N, 1, 1.0, -1.0);
-    if (tmpSpline == NULL) {
-        printf("ERROR: Could not allocate psSpline1D data structure\n");
-        testStatus = false;
-    }
-    if (tmpSpline->spline == NULL) {
-        printf("ERROR: Could not allocate psSpline1D->spline data structure\n");
-        testStatus = false;
-    }
-
-    if (tmpSpline->n != N) {
-        printf("ERROR: spline->n set incorrectly (%d)\n", tmpSpline->n);
-        testStatus = false;
-    }
-
-    for (i=0;i<N;i++) {
-        if (tmpSpline->spline[i] == NULL) {
-            printf("ERROR: Could not allocate spline %d\n", i);
-            testStatus = false;
-        }
-        if ((tmpSpline->spline[i])->n != 2) {
-            printf("ERROR: Spline created with order %d\n", (tmpSpline->spline[i])->n);
-            testStatus = false;
-        }
-    }
-
-    if (tmpSpline->domains == NULL) {
-        printf("ERROR: Could not allocate psSpline1D->domains data structure\n");
-        testStatus = false;
-    }
-
-    for (i=0;i<N+1;i++) {
-        printf("psSpline1D->domains[%d] is %f\n", i, tmpSpline->domains[i]);
-    }
-
-    psFree(tmpSpline);
-    psMemCheckCorruption(1);
-    //    memLeaks = psMemCheckLeaks(currentId,NULL,stderr);
-    if (0 != memLeaks) {
-        psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
-    }
-
-    printFooter(stdout,
-                "psFunctions functions",
-                "psSpline1DAlloc()",
-                testStatus);
-
-    /****************************************************************************/
-    /****************************************************************************/
-    testStatus = true;
-    printPositiveTestHeader(stdout,
-                            "psFunction functions",
-                            "psSpline1DAlloc()");
-
-    tmpSpline = psSpline1DAlloc(N, 3, 1.0, 10.0);
-    if (tmpSpline == NULL) {
-        printf("ERROR: Could not allocate psSpline1D data structure\n");
-        testStatus = false;
-    }
-    if (tmpSpline->spline == NULL) {
-        printf("ERROR: Could not allocate psSpline1D->spline data structure\n");
-        testStatus = false;
-    }
-
-    if (tmpSpline->n != N) {
-        printf("ERROR: spline->n set incorrectly (%d)\n", tmpSpline->n);
-        testStatus = false;
-    }
-
-    for (i=0;i<N;i++) {
-        if (tmpSpline->spline[i] == NULL) {
-            printf("ERROR: Could not allocate spline %d\n", i);
-            testStatus = false;
-        }
-        if ((tmpSpline->spline[i])->n != 4) {
-            printf("ERROR: Spline created with order %d\n", (tmpSpline->spline[i])->n);
-            testStatus = false;
-        }
-    }
-
-    if (tmpSpline->domains == NULL) {
-        printf("ERROR: Could not allocate psSpline1D->domains data structure\n");
-        testStatus = false;
-    }
-
-    for (i=0;i<N+1;i++) {
-        printf("psSpline1D->domains[%d] is %f\n", i, tmpSpline->domains[i]);
-    }
-
-    psFree(tmpSpline);
-    psMemCheckCorruption(1);
-    //    memLeaks = psMemCheckLeaks(currentId,NULL,stderr);
-    if (0 != memLeaks) {
-        psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
-    }
-
-    printFooter(stdout,
-                "psFunctions functions",
-                "psSpline1DAlloc()",
-                testStatus);
-
-    /****************************************************************************/
-    /****************************************************************************/
-    testStatus = true;
-    printPositiveTestHeader(stdout,
-                            "psFunction functions",
-                            "psSpline1DAlloc()");
-
-    tmpSpline = psSpline1DAlloc(N, 3, 1.0, 1.0);
+    p_psSpline1DFree(tmpSpline);
+    psMemCheckCorruption(1);
+    memLeaks = psMemCheckLeaks(currentId,NULL,stderr);
+    if (0 != memLeaks) {
+        psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
+    }
+
+    printFooter(stdout,
+                "psFunctions functions",
+                "psSpline1DAlloc(): linear, min/max are equal",
+                testStatus);
+
+    /****************************************************************************/
+    /****************************************************************************/
+    testStatus = true;
+    printPositiveTestHeader(stdout,
+                            "psFunction functions",
+                            "psSpline1DAlloc(): linear, min > max.");
+
+    tmpSpline = psSpline1DAlloc(N, LINEAR, 1.0, -1.0);
+    if (tmpSpline == NULL) {
+        printf("ERROR: Could not allocate psSpline1D data structure\n");
+        testStatus = false;
+    }
+    if (tmpSpline->spline == NULL) {
+        printf("ERROR: Could not allocate psSpline1D->spline data structure\n");
+        testStatus = false;
+    }
+
+    if (tmpSpline->n != N) {
+        printf("ERROR: spline->n set incorrectly (%d)\n", tmpSpline->n);
+        testStatus = false;
+    }
+
+    for (i=0;i<N;i++) {
+        if (tmpSpline->spline[i] == NULL) {
+            printf("ERROR: Could not allocate spline %d\n", i);
+            testStatus = false;
+        }
+        if ((tmpSpline->spline[i])->n != LINEAR+1) {
+            printf("ERROR: Spline created with order %d\n", (tmpSpline->spline[i])->n);
+            testStatus = false;
+        }
+    }
+
+    if (tmpSpline->domains == NULL) {
+        printf("ERROR: Could not allocate psSpline1D->domains data structure\n");
+        testStatus = false;
+    }
+
+    for (i=0;i<N+1;i++) {
+        printf("psSpline1D->domains[%d] is %f\n", i, tmpSpline->domains[i]);
+    }
+
+    p_psSpline1DFree(tmpSpline);
+    psMemCheckCorruption(1);
+    memLeaks = psMemCheckLeaks(currentId,NULL,stderr);
+    if (0 != memLeaks) {
+        psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
+    }
+
+    printFooter(stdout,
+                "psFunctions functions",
+                "psSpline1DAlloc(): linear, min > max.",
+                testStatus);
+
+    /****************************************************************************/
+    /****************************************************************************/
+    testStatus = true;
+    printPositiveTestHeader(stdout,
+                            "psFunction functions",
+                            "psSpline1DAlloc(), cubic, normal");
+
+    tmpSpline = psSpline1DAlloc(N, CUBIC, 1.0, 10.0);
+    if (tmpSpline == NULL) {
+        printf("ERROR: Could not allocate psSpline1D data structure\n");
+        testStatus = false;
+    }
+    if (tmpSpline->spline == NULL) {
+        printf("ERROR: Could not allocate psSpline1D->spline data structure\n");
+        testStatus = false;
+    }
+
+    if (tmpSpline->n != N) {
+        printf("ERROR: spline->n set incorrectly (%d)\n", tmpSpline->n);
+        testStatus = false;
+    }
+
+    for (i=0;i<N;i++) {
+        if (tmpSpline->spline[i] == NULL) {
+            printf("ERROR: Could not allocate spline %d\n", i);
+            testStatus = false;
+        }
+        if ((tmpSpline->spline[i])->n != CUBIC+1) {
+            printf("ERROR: Spline created with order %d\n", (tmpSpline->spline[i])->n);
+            testStatus = false;
+        }
+    }
+
+    if (tmpSpline->domains == NULL) {
+        printf("ERROR: Could not allocate psSpline1D->domains data structure\n");
+        testStatus = false;
+    }
+
+    for (i=0;i<N+1;i++) {
+        printf("psSpline1D->domains[%d] is %f\n", i, tmpSpline->domains[i]);
+    }
+
+    p_psSpline1DFree(tmpSpline);
+    psMemCheckCorruption(1);
+    memLeaks = psMemCheckLeaks(currentId,NULL,stderr);
+    if (0 != memLeaks) {
+        psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
+    }
+
+    printFooter(stdout,
+                "psFunctions functions",
+                "psSpline1DAlloc(): cubic, normal",
+                testStatus);
+
+    /****************************************************************************/
+    /****************************************************************************/
+    testStatus = true;
+    printPositiveTestHeader(stdout,
+                            "psFunction functions",
+                            "psSpline1DAlloc(): cubic, min/max are equal");
+
+    tmpSpline = psSpline1DAlloc(N, CUBIC, 1.0, 1.0);
 
     if (tmpSpline != NULL) {
@@ -223,68 +224,68 @@
     }
 
-    psFree(tmpSpline);
-    psMemCheckCorruption(1);
-    //    memLeaks = psMemCheckLeaks(currentId,NULL,stderr);
-    if (0 != memLeaks) {
-        psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
-    }
-
-    printFooter(stdout,
-                "psFunctions functions",
-                "psSpline1DAlloc()",
-                testStatus);
-
-    /****************************************************************************/
-    /****************************************************************************/
-    testStatus = true;
-    printPositiveTestHeader(stdout,
-                            "psFunction functions",
-                            "psSpline1DAlloc()");
-
-    tmpSpline = psSpline1DAlloc(N, 3, 1.0, -1.0);
-    if (tmpSpline == NULL) {
-        printf("ERROR: Could not allocate psSpline1D data structure\n");
-        testStatus = false;
-    }
-    if (tmpSpline->spline == NULL) {
-        printf("ERROR: Could not allocate psSpline1D->spline data structure\n");
-        testStatus = false;
-    }
-
-    if (tmpSpline->n != N) {
-        printf("ERROR: spline->n set incorrectly (%d)\n", tmpSpline->n);
-        testStatus = false;
-    }
-
-    for (i=0;i<N;i++) {
-        if (tmpSpline->spline[i] == NULL) {
-            printf("ERROR: Could not allocate spline %d\n", i);
-            testStatus = false;
-        }
-        if ((tmpSpline->spline[i])->n != 4) {
-            printf("ERROR: Spline created with order %d\n", (tmpSpline->spline[i])->n);
-            testStatus = false;
-        }
-    }
-
-    if (tmpSpline->domains == NULL) {
-        printf("ERROR: Could not allocate psSpline1D->domains data structure\n");
-        testStatus = false;
-    }
-
-    for (i=0;i<N+1;i++) {
-        printf("psSpline1D->domains[%d] is %f\n", i, tmpSpline->domains[i]);
-    }
-
-    psFree(tmpSpline);
-    psMemCheckCorruption(1);
-    //    memLeaks = psMemCheckLeaks(currentId,NULL,stderr);
-    if (0 != memLeaks) {
-        psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
-    }
-
-    printFooter(stdout,
-                "psFunctions functions",
-                "psSpline1DAlloc()",
+    p_psSpline1DFree(tmpSpline);
+    psMemCheckCorruption(1);
+    memLeaks = psMemCheckLeaks(currentId,NULL,stderr);
+    if (0 != memLeaks) {
+        psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
+    }
+
+    printFooter(stdout,
+                "psFunctions functions",
+                "psSpline1DAlloc(): cubic, min/max are equal",
+                testStatus);
+
+    /****************************************************************************/
+    /****************************************************************************/
+    testStatus = true;
+    printPositiveTestHeader(stdout,
+                            "psFunction functions",
+                            "psSpline1DAlloc(): cubic, min > max.");
+
+    tmpSpline = psSpline1DAlloc(N, CUBIC, 1.0, -1.0);
+    if (tmpSpline == NULL) {
+        printf("ERROR: Could not allocate psSpline1D data structure\n");
+        testStatus = false;
+    }
+    if (tmpSpline->spline == NULL) {
+        printf("ERROR: Could not allocate psSpline1D->spline data structure\n");
+        testStatus = false;
+    }
+
+    if (tmpSpline->n != N) {
+        printf("ERROR: spline->n set incorrectly (%d)\n", tmpSpline->n);
+        testStatus = false;
+    }
+
+    for (i=0;i<N;i++) {
+        if (tmpSpline->spline[i] == NULL) {
+            printf("ERROR: Could not allocate spline %d\n", i);
+            testStatus = false;
+        }
+        if ((tmpSpline->spline[i])->n != CUBIC+1) {
+            printf("ERROR: Spline created with order %d\n", (tmpSpline->spline[i])->n);
+            testStatus = false;
+        }
+    }
+
+    if (tmpSpline->domains == NULL) {
+        printf("ERROR: Could not allocate psSpline1D->domains data structure\n");
+        testStatus = false;
+    }
+
+    for (i=0;i<N+1;i++) {
+        printf("psSpline1D->domains[%d] is %f\n", i, tmpSpline->domains[i]);
+    }
+
+    p_psSpline1DFree(tmpSpline);
+    psMemCheckCorruption(1);
+    memLeaks = psMemCheckLeaks(currentId,NULL,stderr);
+    if (0 != memLeaks) {
+        psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
+    }
+
+    printFooter(stdout,
+                "psFunctions functions",
+                "psSpline1DAlloc(): cubic, min > max.",
                 testStatus);
 
