Index: trunk/psLib/test/dataManip/tst_psFunc02.c
===================================================================
--- trunk/psLib/test/dataManip/tst_psFunc02.c	(revision 2392)
+++ trunk/psLib/test/dataManip/tst_psFunc02.c	(revision 2717)
@@ -21,4 +21,5 @@
     psS32  currentId = psMemGetId();
     psSpline1D *tmpSpline;
+    psVector* bounds;
 
     /****************************************************************************/
@@ -83,4 +84,5 @@
                             "psSpline1DAlloc(): linear, min/max are equal");
 
+    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message.");
     tmpSpline = psSpline1DAlloc(N, LINEAR, 1.0, 1.0);
 
@@ -217,4 +219,5 @@
                             "psSpline1DAlloc(): cubic, min/max are equal");
 
+    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message");
     tmpSpline = psSpline1DAlloc(N, CUBIC, 1.0, 1.0);
 
@@ -290,4 +293,145 @@
                 testStatus);
 
+    /****************************************************************************/
+    /****************************************************************************/
+    testStatus = true;
+    printPositiveTestHeader(stdout,
+                            "psFunction functions",
+                            "psSpline1DAllocGeneric(): linear, normal");
+
+    bounds = psVectorAlloc(5,PS_TYPE_F32);
+    bounds->n = bounds->nalloc;
+    for(psU32 n = 0; n < 5; n++ ) {
+        bounds->data.F32[n] = (n+1) * 2;
+    }
+    tmpSpline = psSpline1DAllocGeneric(bounds, LINEAR);
+    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]);
+    }
+    psFree(bounds);
+    psFree(tmpSpline);
+    psMemCheckCorruption(1);
+    memLeaks = psMemCheckLeaks(currentId,NULL,stderr,false);
+    if (0 != memLeaks) {
+        psError(PS_ERR_UNKNOWN,true,"Memory Leaks! (%d leaks)", memLeaks);
+        testStatus = false;
+    }
+    printFooter(stdout,
+                "psFunctions functions",
+                "psSpline1DAllocGeneric(): linear, normal",
+                testStatus);
+
+    /****************************************************************************/
+    /****************************************************************************/
+    testStatus = true;
+    printPositiveTestHeader(stdout,
+                            "psFunction functions",
+                            "psSpline1DAllocGeneric(): negative order");
+
+    bounds = psVectorAlloc(5,PS_TYPE_F32);
+    bounds->n = bounds->nalloc;
+    for(psU32 n = 0; n < 5; n++ ) {
+        bounds->data.F32[n] = (n+1) * 2;
+    }
+    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message.");
+    tmpSpline = psSpline1DAllocGeneric(bounds, -1);
+    if (tmpSpline != NULL) {
+        psError(PS_ERR_UNKNOWN,true,"Did not return null for negative order");
+        return 10;
+    }
+    psFree(bounds);
+    psMemCheckCorruption(1);
+    memLeaks = psMemCheckLeaks(currentId,NULL,stderr,false);
+    if (0 != memLeaks) {
+        psError(PS_ERR_UNKNOWN,true,"Memory Leaks! (%d leaks)", memLeaks);
+        testStatus = false;
+    }
+    printFooter(stdout,
+                "psFunctions functions",
+                "psSpline1DAllocGeneric(): negative order",
+                testStatus);
+
+    /****************************************************************************/
+    /****************************************************************************/
+    testStatus = true;
+    printPositiveTestHeader(stdout,
+                            "psFunction functions",
+                            "psSpline1DAllocGeneric(): bound equal to NULL");
+
+    bounds = NULL;
+    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message.");
+    tmpSpline = psSpline1DAllocGeneric(bounds, LINEAR);
+    if (tmpSpline != NULL) {
+        psError(PS_ERR_UNKNOWN,true,"Did not return null for bounds equal to NULL");
+        return 20;
+    }
+    psMemCheckCorruption(1);
+    memLeaks = psMemCheckLeaks(currentId,NULL,stderr,false);
+    if (0 != memLeaks) {
+        psError(PS_ERR_UNKNOWN,true,"Memory Leaks! (%d leaks)", memLeaks);
+        testStatus = false;
+    }
+    printFooter(stdout,
+                "psFunctions functions",
+                "psSpline1DAllocGeneric(): bound equal to NULL",
+                testStatus);
+
+    /****************************************************************************/
+    /****************************************************************************/
+    testStatus = true;
+    printPositiveTestHeader(stdout,
+                            "psFunction functions",
+                            "psSpline1DAllocGeneric(): bounds with zero elements");
+
+    bounds = psVectorAlloc(5,PS_TYPE_F32);
+    bounds->n = 0;
+    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message.");
+    tmpSpline = psSpline1DAllocGeneric(bounds, LINEAR);
+    if (tmpSpline != NULL) {
+        psError(PS_ERR_UNKNOWN,true,"Did not return null for negative order");
+        return 30;
+    }
+    psFree(bounds);
+    psMemCheckCorruption(1);
+    memLeaks = psMemCheckLeaks(currentId,NULL,stderr,false);
+    if (0 != memLeaks) {
+        psError(PS_ERR_UNKNOWN,true,"Memory Leaks! (%d leaks)", memLeaks);
+        testStatus = false;
+    }
+    printFooter(stdout,
+                "psFunctions functions",
+                "psSpline1DAllocGeneric(): bounds with zero elements",
+                testStatus);
+
     return (!testStatus);
 }
