Index: trunk/psLib/test/dataManip/Makefile
===================================================================
--- trunk/psLib/test/dataManip/Makefile	(revision 1761)
+++ trunk/psLib/test/dataManip/Makefile	(revision 1775)
@@ -3,6 +3,6 @@
 ##  Makefile:   test/sysUtils
 ##
-##  $Revision: 1.35 $  $Name: not supported by cvs2svn $
-##  $Date: 2004-07-28 02:50:38 $
+##  $Revision: 1.36 $  $Name: not supported by cvs2svn $
+##  $Date: 2004-09-10 02:55:20 $
 ##
 ##  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -22,4 +22,7 @@
 tst_psFunc00 \
 tst_psFunc01 \
+tst_psFunc02 \
+tst_psFunc03 \
+tst_psFunc04 \
 tst_psHist00 \
 tst_psHist01 \
Index: trunk/psLib/test/dataManip/tst_psFunc02.c
===================================================================
--- trunk/psLib/test/dataManip/tst_psFunc02.c	(revision 1775)
+++ trunk/psLib/test/dataManip/tst_psFunc02.c	(revision 1775)
@@ -0,0 +1,292 @@
+/*****************************************************************************
+    This routine must ensure that the psSpline1DAlloc() function properly
+    allocates the spline data structure.
+ 
+    XXX: figure out the memory deallocator
+ *****************************************************************************/
+#include <stdio.h>
+#include "pslib.h"
+#include "psTest.h"
+#include "psMemory.h"
+#include "psFunctions.h"
+
+#define N 10
+
+int main()
+{
+    int testStatus = true;
+    int memLeaks=0;
+    int i;
+    //    int  currentId = psMemGetId();
+    psSpline1D *tmpSpline;
+
+    /****************************************************************************/
+    /****************************************************************************/
+    testStatus = true;
+    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,NULL);
+    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: allocated psSpline1D data structure when min==max\n");
+        testStatus = false;
+    }
+
+    psFree(tmpSpline);
+    psMemCheckCorruption(1);
+    //    memLeaks = psMemCheckLeaks(currentId,NULL,NULL);
+    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,NULL);
+    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,NULL);
+    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: allocated psSpline1D data structure when min==max\n");
+        testStatus = false;
+    }
+
+    psFree(tmpSpline);
+    psMemCheckCorruption(1);
+    //    memLeaks = psMemCheckLeaks(currentId,NULL,NULL);
+    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,NULL);
+    if (0 != memLeaks) {
+        psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
+    }
+
+    printFooter(stdout,
+                "psFunctions functions",
+                "psSpline1DAlloc()",
+                testStatus);
+
+    return (!testStatus);
+}
Index: trunk/psLib/test/dataManip/tst_psFunc03.c
===================================================================
--- trunk/psLib/test/dataManip/tst_psFunc03.c	(revision 1775)
+++ trunk/psLib/test/dataManip/tst_psFunc03.c	(revision 1775)
@@ -0,0 +1,145 @@
+/*****************************************************************************
+    This routine must ensure that the psSpline1DAllocGeneric() function properly
+    allocates the spline data structure.
+ 
+    XXX: figure out the memory deallocator
+    XXX: test bounds?
+ *****************************************************************************/
+#include <stdio.h>
+#include "pslib.h"
+#include "psTest.h"
+#include "psMemory.h"
+#include "psFunctions.h"
+
+#define N 10
+
+int main()
+{
+    int testStatus = true;
+    int memLeaks=0;
+    int i;
+    //    int  currentId = psMemGetId();
+    psSpline1D *tmpSpline;
+    psVector *bounds;
+
+    /****************************************************************************/
+    /****************************************************************************/
+    testStatus = true;
+    printPositiveTestHeader(stdout,
+                            "psFunction functions",
+                            "psSpline1DAlloc()");
+    bounds = psVectorAlloc(N+1, PS_TYPE_F32);
+    for (i=0;i<N+1;i++) {
+        bounds->data.F32[i] = (float) (3 * i);
+    }
+
+    tmpSpline = psSpline1DAllocGeneric(bounds, 1);
+    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++) {
+        if (tmpSpline->domains[i] != bounds->data.F32[i]) {
+            printf("ERROR: psSpline1D->domains[%d] is %f\n", i, tmpSpline->domains[i]);
+        }
+    }
+
+    psFree(tmpSpline);
+    psMemCheckCorruption(1);
+    //    memLeaks = psMemCheckLeaks(currentId,NULL,NULL);
+    if (0 != memLeaks) {
+        psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
+    }
+
+    printFooter(stdout,
+                "psFunctions functions",
+                "psSpline1DAlloc()",
+                testStatus);
+    /****************************************************************************/
+    /****************************************************************************/
+    testStatus = true;
+    printPositiveTestHeader(stdout,
+                            "psFunction functions",
+                            "psSpline1DAlloc()");
+    bounds = psVectorAlloc(N+1, PS_TYPE_F32);
+    for (i=0;i<N+1;i++) {
+        bounds->data.F32[i] = (float) (3 * i);
+    }
+
+    tmpSpline = psSpline1DAllocGeneric(bounds, 3);
+    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++) {
+        if (tmpSpline->domains[i] != bounds->data.F32[i]) {
+            printf("ERROR: psSpline1D->domains[%d] is %f\n", i, tmpSpline->domains[i]);
+        }
+    }
+
+    psFree(tmpSpline);
+    psMemCheckCorruption(1);
+    //    memLeaks = psMemCheckLeaks(currentId,NULL,NULL);
+    if (0 != memLeaks) {
+        psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
+    }
+
+    printFooter(stdout,
+                "psFunctions functions",
+                "psSpline1DAlloc()",
+                testStatus);
+
+    return (!testStatus);
+}
Index: trunk/psLib/test/dataManip/tst_psFunc04.c
===================================================================
--- trunk/psLib/test/dataManip/tst_psFunc04.c	(revision 1775)
+++ trunk/psLib/test/dataManip/tst_psFunc04.c	(revision 1775)
@@ -0,0 +1,58 @@
+/*****************************************************************************
+    This routine must ensure that the psSpline1DAlloc() function properly
+    allocates the spline data structure.
+ 
+    XXX: figure out the memory deallocator
+ *****************************************************************************/
+#include <stdio.h>
+#include "pslib.h"
+#include "psTest.h"
+#include "psMemory.h"
+#include "psFunctions.h"
+
+#define N 10
+
+int main()
+{
+    int testStatus = true;
+    int memLeaks=0;
+    int i;
+    float tmp;
+    //    int  currentId = psMemGetId();
+    psSpline1D *tmpSpline;
+    psVector *data;
+
+    psTraceSetLevel(".", 9);
+    /****************************************************************************/
+    /****************************************************************************/
+    testStatus = true;
+    printPositiveTestHeader(stdout,
+                            "psFunction functions",
+                            "psSpline1DAlloc()");
+    data = psVectorAlloc(N+1, PS_TYPE_F32);
+    tmpSpline = psSpline1DAlloc(N, 1, 1.0, 10.0);
+
+    for (i=0;i<N+1;i++) {
+        data->data.F32[i] = (float) tmpSpline->domains[i];
+    }
+
+    psSpline1DGen(tmpSpline, data);
+    for (i=0;i<N+1;i++) {
+        tmp = psSpline1DEval(tmpSpline, (float) i+1);
+        printf("%f -> %f\n", (float) i+1, tmp);
+    }
+
+    psFree(tmpSpline);
+    psMemCheckCorruption(1);
+    //    memLeaks = psMemCheckLeaks(currentId,NULL,NULL);
+    if (0 != memLeaks) {
+        psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
+    }
+
+    printFooter(stdout,
+                "psFunctions functions",
+                "psSpline1DAlloc()",
+                testStatus);
+
+    return (!testStatus);
+}
