Index: /trunk/psLib/test/math/tap_psFunc01.c
===================================================================
--- /trunk/psLib/test/math/tap_psFunc01.c	(revision 10945)
+++ /trunk/psLib/test/math/tap_psFunc01.c	(revision 10945)
@@ -0,0 +1,55 @@
+/*****************************************************************************
+    This routine must ensure that the psGaussian() shall evaluate a
+    specified Gaussian at some X.
+ 
+    It also tests the p_psGaussianDev() procedure.
+ *****************************************************************************/
+#include <stdio.h>
+#include <string.h>
+#include <pslib.h>
+#include "tap.h"
+#include "pstap.h"
+#define MY_MEAN 5.0
+#define MY_STDEV 2.0
+#define TOLERANCE 0.01
+psF32 truth1[10] = {0.008764, 0.026995, 0.064759, 0.120985, 0.176033, 0.199471, 0.176033, 0.120985, 0.064759, 0.026995};
+psF32 truth2[10] = {0.043937, 0.135335, 0.324652, 0.606531, 0.882497, 1.000000, 0.882497, 0.606531, 0.324652, 0.135335};
+
+int main()
+{
+    psLogSetFormat("HLNM");
+    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++)
+        {
+            psF32 actual = psGaussian((psF32) x, MY_MEAN, MY_STDEV, true);
+            if (fabs(truth1[x] - actual) > TOLERANCE) {
+                diag("ERROR: the Gaussian at %.2f was %f, should be %f", (psF32) x, actual, truth1[x]);
+                errorFlag = true;
+            }
+        }
+        ok(!errorFlag, "psGaussian() produced consistent results (normalized)");
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+    // Test the psGaussian(): non-normalized version
+    {
+        psMemId id = psMemGetId();
+        bool errorFlag = false;
+        for (psS32 x = 0 ; x < (int) (MY_MEAN * 2.0) ; x++)
+        {
+            psF32 actual = psGaussian((psF32) x, MY_MEAN, MY_STDEV, false);
+            if (fabs(truth2[x] - actual) > TOLERANCE) {
+                diag("ERROR: the Gaussian at %.2f was %f, should be %f", (psF32) x, actual, truth1[x]);
+                errorFlag = true;
+            }
+        }
+        ok(!errorFlag, "psGaussian() produced consistent results (non-normalized)");
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+}
Index: /trunk/psLib/test/math/tap_psMathUtils.c
===================================================================
--- /trunk/psLib/test/math/tap_psMathUtils.c	(revision 10945)
+++ /trunk/psLib/test/math/tap_psMathUtils.c	(revision 10945)
@@ -0,0 +1,222 @@
+/*****************************************************************************
+This routine contains code which tests the general math utility functions.
+ 
+XXX: This test never really was complete.  I simply converted the lates version
+to libtap format.  It really needs more work.
+ *****************************************************************************/
+#include <stdio.h>
+#include <string.h>
+#include <pslib.h>
+#include "tap.h"
+#include "pstap.h"
+
+#define NUM_DATA 10
+#define VERBOSE 0
+#define EXTRA_VERBOSE 0
+#define TS00_X_F32  0x00000001
+#define TS00_X_F64  0x00000002
+#define TS00_X_NULL  0x00000004
+#define TS00_DOMAIN_F32  0x00000008
+#define TS00_DOMAIN_F64  0x00000010
+#define TS00_DOMAIN_NULL 0x00000020
+#define TS00_RANGE_F32  0x00000040
+#define TS00_RANGE_F64  0x00000080
+#define TS00_RANGE_NULL  0x00000200
+#define TOLERANCE 0.01
+
+psS32 genericInterpolateTest(
+    psU32 flags,
+    psS32 order,
+    psS32 numData,
+    psF64 xValue,
+    psBool expectedRC)
+{
+    psS32 testStatus = true;
+    psScalar *x = NULL;
+    psVector *domain = NULL;
+    psVector *range = NULL;
+    psScalar *out = NULL;
+
+    psMemId id = psMemGetId();
+    if (expectedRC == false && VERBOSE) {
+        printf("This test should generate an error message, and return NULL.\n");
+    }
+
+    if (flags & TS00_X_NULL) {
+        if (VERBOSE)
+            printf(" using a NULL x scalar\n");
+    }
+
+    if (flags & TS00_X_F32) {
+        if (VERBOSE)
+            printf(" using a psF32 x scalar\n");
+        x = psScalarAlloc((psF32) xValue, PS_TYPE_F32);
+    }
+
+    if (flags & TS00_X_F64) {
+        if (VERBOSE)
+            printf(" using a psF64 x scalar\n");
+        x = psScalarAlloc((psF64) xValue, PS_TYPE_F64);
+    }
+
+    if (flags & TS00_DOMAIN_NULL) {
+        if (VERBOSE)
+            printf(" using a NULL domain vector\n");
+    }
+
+    if (flags & TS00_DOMAIN_F32) {
+        if (VERBOSE)
+            printf(" using a psF32 domain vector\n");
+        domain = psVectorAlloc(numData, PS_TYPE_F32);
+        for (psS32 i=0;i<numData;i++) {
+            domain->data.F32[i] = (psF32) i;
+        }
+
+        if (VERBOSE) {
+            for (psS32 i=0;i<numData;i++) {
+                if (VERBOSE)
+                    printf("Original domain data %d: (%.1f)\n", i, domain->data.F32[i]);
+            }
+        }
+    }
+
+    if (flags & TS00_DOMAIN_F64) {
+        if (VERBOSE)
+            printf(" using a psF64 domain vector\n");
+        domain = psVectorAlloc(numData, PS_TYPE_F64);
+        for (psS64 i=0;i<numData;i++) {
+            domain->data.F64[i] = (psF64) i;
+        }
+
+        if (EXTRA_VERBOSE) {
+            for (psS32 i=0;i<numData;i++) {
+                printf("Original domain data %d: (%.1f)\n", i, domain->data.F64[i]);
+            }
+        }
+    }
+
+    if (flags & TS00_RANGE_NULL) {
+        if (VERBOSE)
+            printf(" using a NULL range vector\n");
+    }
+
+    if (flags & TS00_RANGE_F32) {
+        if (VERBOSE)
+            printf(" using a psF32 range vector\n");
+        range = psVectorAlloc(numData, PS_TYPE_F32);
+        for (psS32 i=0;i<numData;i++) {
+            range->data.F32[i] = (psF32) 2*i;
+        }
+
+        if (EXTRA_VERBOSE) {
+            for (psS32 i=0;i<numData;i++) {
+                printf("Original range data %d: (%.1f)\n", i, range->data.F32[i]);
+            }
+        }
+    }
+
+    if (flags & TS00_RANGE_F64) {
+        if (VERBOSE)
+            printf(" using a psF64 range vector\n");
+        range = psVectorAlloc(numData, PS_TYPE_F64);
+        for (psS64 i=0;i<numData;i++) {
+            range->data.F64[i] = (psF64) 2*i;
+        }
+
+        if (EXTRA_VERBOSE) {
+            for (psS32 i=0;i<numData;i++) {
+                printf("Original range data %d: (%.1f)\n", i, range->data.F64[i]);
+            }
+        }
+    }
+
+    out = p_psVectorInterpolate(NULL, domain, range, order, x);
+    if (out == NULL) {
+        if (expectedRC == true) {
+            diag("TEST ERROR: the p_psVectorInterpolate function returned NULL.\n");
+            testStatus = false;
+        }
+    } else {
+        if (expectedRC == false) {
+            diag("TEST ERROR: the p_psVectorInterpolate function returned non-NULL.\n");
+            testStatus = false;
+        }
+
+        if (flags & TS00_X_F32) {
+            if ((out->data.F32 - (2.0 * x->data.F32)) > TOLERANCE) {
+                diag("The interpolated value was %.2f: should be %.2f\n", out->data.F32, 2.0 * x->data.F32);
+                testStatus = false;
+            }
+
+        } else if (flags & TS00_X_F64) {
+            if ((out->data.F64 - (2.0 * x->data.F64)) > TOLERANCE) {
+                diag("The interpolated value was %.2f: should be %.2f\n", out->data.F64, 2.0 * x->data.F64);
+                testStatus = false;
+            }
+        }
+
+        /*
+        if (0) {
+                if (flags & TS00_F_F32) {
+                    expectData = f->data.F32[i];
+                } else if (flags & TS00_F_F64) {
+                    expectData = (psF32) f->data.F64[i];
+                } else if (flags & TS00_F_S32) {
+                    expectData = (psF32) f->data.S32[i];
+                }
+         
+                    if (flags & TS00_X_F32) {
+                        xData = x->data.F32[i];
+                    } else if (flags & TS00_X_F64) {
+                        xData = (psF32) x->data.F64[i];
+                    } else if (flags & TS00_X_S32) {
+                        xData = (psF32) x->data.S32[i];
+                    } else if (flags & TS00_X_NULL) {
+                        if (flags & TS00_POLY_ORD) {
+                            xData = (psF32) i;
+                        } else if (flags & TS00_POLY_CHEB) {
+                            xData = ((2.0 / ((psF32) (numData - 1))) * ((psF32) i)) - 1.0;
+                        }
+                    }
+         
+                    psF32 actualData = psPolynomial1DEval(myPoly, xData);
+         
+                    if (fabs(actualData-expectData) > fabs(ERROR_TOLERANCE * expectData)) {
+                        printf("TEST ERROR: Fitted data %d: (%.1f %.1f), expected was (%.1f)\n",
+                               i, xData, actualData, expectData);
+                        testStatus = false;
+                     } else {
+                        if (VERBOSE) {
+                            printf("GOOD: Fitted data %d: (%.1f %.1f), expected was (%.1f)\n",
+                                     i, xData, actualData, expectData);
+                        }
+                    }
+                }
+        }
+        */
+    }
+
+    psFree(x);
+    psFree(out);
+    psFree(domain);
+    psFree(range);
+    ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+
+    return (testStatus);
+}
+
+/*****************************************************************************
+ *****************************************************************************/
+psS32 main()
+{
+    psLogSetFormat("HLNM");
+    plan_tests(2);
+
+    //
+    // F32 tests:
+    //
+    // All Vectors non-NULL
+
+    ok(genericInterpolateTest(TS00_X_F32 | TS00_DOMAIN_F32 | TS00_RANGE_F32, 5, NUM_DATA, 5.5, true),
+       "p_psVectorInterpolate() worked");
+}
Index: /trunk/psLib/test/math/tap_psMatrixVectorArithmetic02.c
===================================================================
--- /trunk/psLib/test/math/tap_psMatrixVectorArithmetic02.c	(revision 10945)
+++ /trunk/psLib/test/math/tap_psMatrixVectorArithmetic02.c	(revision 10945)
@@ -0,0 +1,547 @@
+
+/** @file  tst_psMatrixVectorArithmetic02.c
+ *
+ *  @brief Test driver for psMatrixVector arithmetic functions
+ *
+ *  This test driver tests combinations of matrix, vector, and scalar unary operations including:
+ *     Matrix with all math operators with S32, F32, F64, C32
+ *     Vector with all math operators with S32, F32, F64, C32
+ *
+ *  @author  Ross Harman, MHPCC
+ *
+ *  @version $Revision: 1.1 $  $Name: not supported by cvs2svn $
+ *  @date  $Date: 2007-01-06 00:48:54 $
+ *
+ *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
+ *
+ */
+#include <stdio.h>
+#include <string.h>
+#include <pslib.h>
+#include "tap.h"
+#include "pstap.h"
+
+#define CHECK_VECTOR(VECTOR,TYPE,TRUTH,ERRORFLAG)                                                                      \
+{ \
+    for(psS32 i=0; i<VECTOR->n; i++) {                                                                             \
+        if(cabs(VECTOR->data.TYPE[i])-cabs(TRUTH) > FLT_EPSILON){                                                \
+            ERRORFLAG = true; \
+            diag("ERROR:Truth and calculated values don't match for vector operation:\n");                     \
+            if(PS_IS_PSELEMTYPE_COMPLEX(VECTOR->type.type)) {                                                    \
+                diag("Truth: %.2f%+.2fi\n", creal(VECTOR->data.TYPE[i]), cimag(VECTOR->data.TYPE[i]));         \
+                diag("Calculated: %.2f%+.2fi\n", creal(TRUTH), cimag(TRUTH));                                  \
+            } else if(PS_IS_PSELEMTYPE_INT(VECTOR->type.type)) {                                                 \
+                diag("Truth: %d\n", (psS32)(VECTOR->data.TYPE[i]));                                              \
+                diag("Calculated: %d\n", (psS32)(TRUTH));                                                        \
+            } else {                                                                                             \
+                diag("Truth: %.2f\n", (double)(VECTOR->data.TYPE[i]));                                         \
+                diag("Calculated: %.2f\n", (double)(TRUTH));                                                   \
+            }                                                                                                    \
+            diag("\n"); \
+        }                                                                                                        \
+    }                                                                                                            \
+}
+
+#define CHECK_MATRIX(IMAGE,TYPE,TRUTH,ERRORFLAG)                                                                       \
+{ \
+    for(psS32 i=IMAGE->numRows-1; i>-1; i--) {                                                                     \
+        for(psS32 j=0; j<IMAGE->numCols; j++) {                                                                    \
+            if(cabs(IMAGE->data.TYPE[i][j])-cabs(TRUTH) > FLT_EPSILON){                                          \
+                ERRORFLAG = true; \
+                diag("ERROR:Truth and calculated values don't match for matrix operation:\n");                 \
+                if(PS_IS_PSELEMTYPE_COMPLEX(IMAGE->type.type)) {                                                 \
+                    diag("Truth: %.2f%+.2fi\n", creal(IMAGE->data.TYPE[i][j]), cimag(IMAGE->data.TYPE[i][j])); \
+                    diag("Calculated: %.2f%+.2fi\n", creal(TRUTH), cimag(TRUTH));                              \
+                } else if(PS_IS_PSELEMTYPE_INT(IMAGE->type.type)) {                                              \
+                    diag("Truth: %d\n", (psS32)(IMAGE->data.TYPE[i][j]));                                        \
+                    diag("Calculated: %d\n", (psS32)(TRUTH));                                                    \
+                } else {                                                                                         \
+                    diag("Truth: %.2f\n", (double)(IMAGE->data.TYPE[i][j]));                                   \
+                    diag("Calculated: %.2f\n", (double)(TRUTH));                                               \
+                }                                                                                                \
+                diag("\n");                                                                                            \
+                diag("\n");                                                                                            \
+            }                                                                                                    \
+        }                                                                                                        \
+    }                                                                                                            \
+}
+
+#define CREATE_AND_SET_VECTOR(NAME,TYPE,VALUE,SIZE)                                                          \
+psVector *NAME = (psVector*)psVectorAlloc(SIZE, PS_TYPE_##TYPE);                                             \
+for(psS32 i=0; i<SIZE; i++) {                                                                                  \
+    NAME->data.TYPE[i] = VALUE;                                                                              \
+}                                                                                                            \
+NAME->n = SIZE;
+
+
+#define CREATE_AND_SET_IMAGE(NAME,TYPE,VALUE,NROWS,NCOLS)                                                    \
+psImage *NAME = (psImage*)psImageAlloc(NCOLS,NROWS,PS_TYPE_##TYPE);                                          \
+for(psS32 i=0; i<NAME->numRows; i++) {                                                                         \
+    for(psS32 j=0; j<NAME->numCols; j++) {                                                                     \
+        NAME->data.TYPE[i][j] = VALUE;                                                                       \
+    }                                                                                                        \
+}
+
+
+#define CHECK_MEMORY \
+if( psMemCheckLeaks(0, NULL, stdout, false) != 0 ) {  \
+    psError(PS_ERR_UNKNOWN, true,"Memory leaks detected."); \
+    return 50; \
+} \
+psS32 nBad = psMemCheckCorruption(0); \
+if(nBad) { \
+    psError(PS_ERR_UNKNOWN, true,"ERROR: Found %d bad memory blocks\n", nBad); \
+    return 51; \
+}
+
+// Test matrix unary operations
+#define testUnaryOpM(OP,TYPE,VALUE1,VALUE2,NROWS,NCOLS,TRUTH,ERRORFLAG,MEMORYFLAG) \
+{                                                                                  \
+    psMemId id = psMemGetId();                                                     \
+    ERRORFLAG = false;                                                             \
+    MEMORYFLAG = false;                                                            \
+    CREATE_AND_SET_IMAGE(inImage,TYPE,VALUE1,NROWS,NCOLS);                         \
+    CREATE_AND_SET_IMAGE(outImage,TYPE,VALUE2,NROWS,NCOLS);                        \
+    outImage = (psImage*)psUnaryOp(outImage, inImage, #OP);                        \
+    CHECK_MATRIX(outImage,TYPE,TRUTH,ERRORFLAG);                                   \
+    psFree(inImage);                                                               \
+    psFree(outImage);                                                              \
+    MEMORYFLAG = psMemCheckLeaks(id, NULL, NULL, false);                           \
+}
+
+// Test vector unary operations
+#define testUnaryOpV(OP,TYPE,VALUE1,VALUE2,SIZE,TRUTH,ERRORFLAG,MEMORYFLAG)        \
+{                                                                                  \
+    psMemId id = psMemGetId();                                                     \
+    ERRORFLAG = false;                                                             \
+    MEMORYFLAG = false;                                                            \
+    CREATE_AND_SET_VECTOR(inVector,TYPE,VALUE1,SIZE);                              \
+    CREATE_AND_SET_VECTOR(outVector,TYPE,VALUE2,SIZE);                             \
+    outVector = (psVector*)psUnaryOp(outVector, inVector, #OP);                    \
+    CHECK_VECTOR(outVector,TYPE,TRUTH,ERRORFLAG);                                  \
+    psFree(inVector);                                                              \
+    psFree(outVector);                                                             \
+    MEMORYFLAG = psMemCheckLeaks (id, NULL, NULL, false);                          \
+}
+
+
+psS32 main( psS32 argc, char* argv[] )
+{
+    psLogSetFormat("HLNM");
+    plan_tests(272);
+    bool errorFlag = false;
+    bool memoryFlag = false;
+
+    testUnaryOpM( abs, S32, -10, 0, 3, 2, 10, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): abs was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( abs, F32, -10.0, 0.0, 3, 2, 10.0, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): abs was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( abs, F64, -10.0, 0.0, 3, 2, 10.0, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): abs was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( abs, C32, -10.0 - 10.0i, 0.0 + 0.0i, 3, 2,10+10i, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): abs was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( exp, S32, 10, 0, 3, 2, exp(10), errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): exp was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( exp, F32, 10.0, 0.0, 3, 2, cexp(10.0), errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): exp was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( exp, F64, 10.0, 0.0, 3, 2, cexp(10.0), errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): exp was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( exp, C32, 1.0 + 1.0i, 0.0 + 0.0i, 3, 2, cexp(1.0+1.0i), errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): exp was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( ln, S32, 10, 0, 3, 2, clog(10), errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): ln was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( ln, F32, 10.0, 0.0, 3, 2, clog(10.0), errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): ln was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( ln, F64, 10.0, 0.0, 3, 2, clog(10.0), errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): ln was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( ln, C32, 10.0 + 10.0i, 0.0 + 0.0i, 3, 2, clog(10.0+10.0i), errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): ln was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( ten, S32, 3, 0, 3, 2, 1000, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): ten was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( ten, F32, 3.0, 0.0, 3, 2, 1000, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): ten was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( ten, F64, 3.0, 0.0, 3, 2, 1000, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): ten was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( ten, C32, 1.0 + 0.0i, 0.0 + 0.0i, 3, 2, 10.0, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): ten was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( log, S32, 1000, 0, 3, 2, 3, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): log was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( log, F32, 1000.0, 0.0, 3, 2, 3, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): log was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( log, F64, 1000.0, 0.0, 3, 2, 3, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): log was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( log, C32, 1000.0 + 0.0i, 0.0 + 0.0i, 3, 2, 3, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): log was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( sin, S32, M_PI_2, 0, 3, 2, 1, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): sin was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( sin, F32, M_PI_2, 0.0, 3, 2, 1.0, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): sin was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( sin, F64, M_PI_2, 0.0, 3, 2, 1.0, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): sin was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( sin, C32, M_PI_2 + 0.0i, 0.0 + 0.0i, 3, 2, 1.0, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): sin was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( dsin, S32, 90, 0, 3, 2 , 1, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): dsin was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( dsin, F32, 90.0, 0.0, 3, 2, 1.0, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): dsin was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( dsin, F64, 90.0, 0.0, 3, 2, 1.0, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): dsin was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( dsin, C32, 90.0 + 00.0i, 0.0 + 0.0i, 3, 2, 1.0, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): dsin was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( cos, S32, 0, 0, 3, 2, 1, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): cos was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( cos, F32, 0.0, 0.0, 3, 2, 1.0, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): cos was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( cos, F64, 0.0, 0.0, 3, 2, 1.0, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): cos was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( cos, C32, 0.0 + 0.0i, 0.0 + 0.0i, 3, 2, 1.0, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): cos was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( dcos, S32, 0, 0, 3, 2, 1, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): dcos was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( dcos, F32, 0.0, 0.0, 3, 2, 1.0, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): dcos was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( dcos, F64, 0.0, 0.0, 3, 2, 1.0, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): dcos was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( dcos, C32, 0.0 + 0.0i, 0.0 + 0.0i, 3, 2, 1.0, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): dcos was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( tan, S32, M_PI_4, 0, 3, 2, 1, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): tan was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( tan, F32, M_PI_4, 0.0, 3, 2, 1.0, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): tan was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( tan, F64, M_PI_4, 0.0, 3, 2, 1.0, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): tan was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( tan, C32, M_PI_4 + 0.0i, 0.0 + 0.0i, 3, 2, 1, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): tan was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( dtan, S32, 45, 0, 3, 2, 1, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): dtan was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( dtan, F32, 45.0, 0.0, 3, 2, 1.0, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): dtan was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( dtan, F64, 45.0, 0.0, 3, 2, 1.0, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): dtan was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( dtan, C32, 45.0 + 45.0i, 0.0 + 0.0i, 3, 2, 1.0, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): dtan was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( asin, S32, 1, 0, 3, 2, M_PI_2, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): asin was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( asin, F32, 1.0, 0.0, 3, 2, M_PI_2 , errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): asin was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( asin, F64, 1.0, 0.0, 3, 2, M_PI_2, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): asin was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( asin, C32, 1.0 + 1.0i, 0.0 + 0.0i, 3, 2, M_PI_2, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): asin was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( dasin, S32, 1.0, 0, 3, 2, 90, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): dasin was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( dasin, F32, 1.0, 0.0, 3, 2, 90.0, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): dasin was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( dasin, F64, 1.0, 0.0, 3, 2, 90.0, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): dasin was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( dasin, C32, 1.0 + 1.0i, 0.0 + 0.0i, 3, 2, 90.0, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): dasin was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( acos, S32, 0, 0, 3, 2, M_PI_2, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): acos was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( acos, F32, 0.0, 0.0, 3, 2, M_PI_2, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): acos was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( acos, F64, 0.0, 0.0, 3, 2, M_PI_2, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): acos was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( acos, C32, 0.0 + 0.0i, 0.0 + 0.0i, 3, 2, M_PI_2, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): acos was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( dacos, S32, 0, 0, 3, 2, 90, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): dacos was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( dacos, F32, 0.0, 0.0, 3, 2, 90.0, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): dacos was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( dacos, F64, 0.0, 0.0, 3, 2, 90.0, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): dacos was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( dacos, C32, 0.0 + 0.0i, 0.0 + 0.0i, 3, 2, 90.0, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): dacos was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( atan, S32, 1, 0, 3, 2, M_PI_4, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): atan was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( atan, F32, 1.0, 0.0, 3, 2, M_PI_4, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): atan was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( atan, F64, 1.0, 0.0, 3, 2, M_PI_4, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): atan was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( atan, C32, 1.0 + 0.0i, 0.0 + 0.0i, 3, 2, M_PI_4, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): atan was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( datan, S32, 1, 0, 3, 2, 45, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): datan was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( datan, F32, 1.0, 0.0, 3, 2, 45.0, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): datan was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( datan, F64, 1.0, 0.0, 3, 2, 45.0, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): datan was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpM( datan, C32, 1.0 + 0.0i, 0.0 + 0.0i, 3, 2, 45.0, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): datan was successful");
+    ok(memoryFlag== false, "no memory leaks");
+
+    testUnaryOpV( abs, S32, -10, 0, 3, 10, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): abs was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( abs, F32, -10.0, 0.0, 3, 10.0, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): abs was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( abs, F64, -10.0, 0.0, 3, 10.0, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): abs was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( abs, C32, -10.0 - 10.0i, 0.0 + 0.0i, 3, 10+10i, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): abs was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( exp, S32, 10, 0, 3, cexp(10), errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): exp was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( exp, F32, 10.0, 0.0, 3, cexp(10.0), errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): exp was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( exp, F64, 10.0, 0.0, 3, cexp(10.0), errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): exp was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( exp, C32, 1.0 + 1.0i, 0.0 + 0.0i, 3, cexp(1.0+1.0i), errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): exp was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( ln, S32, 10, 0, 3, clog(10), errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): ln was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( ln, F32, 10.0, 0.0, 3, clog(10.0), errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): ln was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( ln, F64, 10.0, 0.0, 3, clog(10.0), errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): ln was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( ln, C32, 10.0 + 10.0i, 0.0 + 0.0i, 3, clog(10.0+10.0i), errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): ln was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( ten, S32, 3, 0, 3, 1000, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): ten was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( ten, F32, 3.0, 0.0, 3, 1000, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): ten was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( ten, F64, 3.0, 0.0, 3, 1000, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): ten was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( ten, C32, 1.0 + 0.0i, 0.0 + 0.0i, 3, 10.0, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): ten was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( log, S32, 1000, 0, 3,  3, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): log was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( log, F32, 1000.0, 0.0, 3, 3, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): log was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( log, F64, 1000.0, 0.0, 3, 3, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): log was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( log, C32, 1000.0 + 0.0i, 0.0 + 0.0i, 3, 3, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): log was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( sin, S32, M_PI_2, 0, 3, 1, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): sin was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( sin, F32, M_PI_2, 0.0, 3, 1.0, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): sin was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( sin, F64, M_PI_2, 0.0, 3, 1.0, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): sin was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( sin, C32, M_PI_2 + 0.0i, 0.0 + 0.0i, 3, 1.0, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): sin was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( dsin, S32, 90, 0, 3, 1, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): dsin was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( dsin, F32, 90.0, 0.0, 3, 1.0, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): dsin was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( dsin, F64, 90.0, 0.0, 3, 1.0, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): dsin was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( dsin, C32, 90.0 + 00.0i, 0.0 + 0.0i, 3, 1.0, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): dsin was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( cos, S32, 0, 0, 3, 1, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): cos was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( cos, F32, 0.0, 0.0, 3, 1.0, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): cos was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( cos, F64, 0.0, 0.0, 3, 1.0, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): cos was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( cos, C32, 0.0 + 0.0i, 0.0 + 0.0i, 3, 1.0, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): cos was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( dcos, S32, 0, 0, 3, 1, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): dcos was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( dcos, F32, 0.0, 0.0, 3, 1.0, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): dcos was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( dcos, F64, 0.0, 0.0, 3, 1.0, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): dcos was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( dcos, C32, 0.0 + 0.0i, 0.0 + 0.0i, 3, 1.0, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): dcos was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( tan, S32, M_PI_4, 0, 3, 1, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): tan was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( tan, F32, M_PI_4, 0.0, 3, 1.0, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): tan was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( tan, F64, M_PI_4, 0.0, 3, 1.0, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): tan was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( tan, C32, M_PI_4 + 0.0i, 0.0 + 0.0i, 3, 1, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): tan was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( dtan, S32, 45, 0, 3, 1, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): dtan was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( dtan, F32, 45.0, 0.0, 3, 1.0, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): dtan was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( dtan, F64, 45.0, 0.0, 3, 1.0, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): dtan was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( dtan, C32, 45.0 + 45.0i, 0.0 + 0.0i, 3, 1.0, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): dtan was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( asin, S32, 1, 0, 3, M_PI_2, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): asin was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( asin, F32, 1.0, 0.0, 3, M_PI_2 , errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): asin was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( asin, F64, 1.0, 0.0, 3, M_PI_2, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): asin was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( asin, C32, 1.0 + 1.0i, 0.0 + 0.0i, 3, M_PI_2, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): asin was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( dasin, S32, 1.0, 0, 3, 90, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): dasin was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( dasin, F32, 1.0, 0.0, 3, 90.0, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): dasin was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( dasin, F64, 1.0, 0.0, 3, 90.0, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): dasin was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( dasin, C32, 1.0 + 1.0i, 0.0 + 0.0i, 3, 90.0, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): dasin was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( acos, S32, 0, 0, 3, M_PI_2, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): acos was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( acos, F32, 0.0, 0.0, 3, M_PI_2, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): acos was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( acos, F64, 0.0, 0.0, 3, M_PI_2, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): acos was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( acos, C32, 0.0 + 0.0i, 0.0 + 0.0i, 3, M_PI_2, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): acos was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( dacos, S32, 0, 0, 3, 90, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): dacos was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( dacos, F32, 0.0, 0.0, 3, 90.0, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): dacos was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( dacos, F64, 0.0, 0.0, 3, 90.0, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): dacos was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( dacos, C32, 0.0 + 0.0i, 0.0 + 0.0i, 3, 90.0, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): dacos was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( atan, S32, 1, 0, 3, M_PI_4, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): atan was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( atan, F32, 1.0, 0.0, 3, M_PI_4, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): atan was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( atan, F64, 1.0, 0.0, 3, M_PI_4, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): atan was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( atan, C32, 1.0 + 0.0i, 0.0 + 0.0i, 3, M_PI_4, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): atan was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( datan, S32, 1, 0, 3, 45, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): datan was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( datan, F32, 1.0, 0.0, 3, 45.0, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): datan was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( datan, F64, 1.0, 0.0, 3, 45.0, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): datan was successful");
+    ok(memoryFlag== false, "no memory leaks");
+    testUnaryOpV( datan, C32, 1.0 + 0.0i, 0.0 + 0.0i, 3, 45.0, errorFlag, memoryFlag);
+    ok(errorFlag== false, "psUnaryOp(): datan was successful");
+    ok(memoryFlag== false, "no memory leaks");
+
+    return 0;
+}
+
Index: /trunk/psLib/test/math/tap_psMatrixVectorArithmetic03.c
===================================================================
--- /trunk/psLib/test/math/tap_psMatrixVectorArithmetic03.c	(revision 10945)
+++ /trunk/psLib/test/math/tap_psMatrixVectorArithmetic03.c	(revision 10945)
@@ -0,0 +1,281 @@
+/** @file  tst_psMatrixVectorArithmetic03.c
+ *
+ *  @brief Test driver for psMatrixVector arithmetic functions
+ *
+ *  This test driver contains negative tests for psBinaryOp and psUanryOp:
+ *     Check for NULL arguments
+ *     Inconsistent element types
+ *     Inconsistent element count
+ *     Inconsistent dimensionality
+ *     Division by zero
+ *     Attempt to use min with complex numbers
+ *     Attempt to use max with complex numbers
+ *     Invalid operation
+ *
+ * XXX: Many of these tests are desinged to produce an error.  They are commented out.
+ *
+ *  @author  Ross Harman, MHPCC
+ *
+ *  @version $Revision: 1.1 $  $Name: not supported by cvs2svn $
+ *  @date  $Date: 2007-01-06 00:48:54 $
+ *
+ *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
+ *
+ */
+#include <stdio.h>
+#include <string.h>
+#include <pslib.h>
+#include "tap.h"
+#include "pstap.h"
+
+#define CREATE_AND_SET_VECTOR(NAME,TYPE,VALUE,SIZE) \
+psVector *NAME = (psVector*)psVectorAlloc(SIZE, PS_TYPE_##TYPE); \
+for(psS32 i=0; i<SIZE; i++) { \
+    NAME->data.TYPE[i] = VALUE; \
+} \
+NAME->n = SIZE;
+
+
+#define CREATE_AND_SET_IMAGE(NAME,TYPE,VALUE,NROWS,NCOLS) \
+psImage *NAME = (psImage*)psImageAlloc(NCOLS,NROWS,PS_TYPE_##TYPE); \
+for(psS32 i=0; i<NAME->numRows; i++) { \
+    for(psS32 j=0; j<NAME->numCols; j++) { \
+        NAME->data.TYPE[i][j] = VALUE; \
+    } \
+}
+
+
+psS32 main(psS32 argc, char* argv[])
+{
+    psLogSetFormat("HLNM");
+    plan_tests(5);
+    psMemId idGlobal = psMemGetId();
+
+    CREATE_AND_SET_IMAGE(image1,F64,0,3,3);
+    CREATE_AND_SET_IMAGE(image2,F64,0,3,3);
+    CREATE_AND_SET_IMAGE(image3,F32,0,3,3);
+    CREATE_AND_SET_IMAGE(image4,F64,0,2,2);
+    CREATE_AND_SET_IMAGE(image5,C32,1+1i,3,3);
+    CREATE_AND_SET_VECTOR(vector1,F64,0,2);
+    CREATE_AND_SET_VECTOR(vector2,F64,0,3);
+
+    // Check for NULL output argument
+    {
+        psMemId id = psMemGetId();
+        psImage* image6 = (psImage*)psBinaryOp(NULL, image1, "+", image2);
+        ok(image6 != NULL, "psBinaryOp() produced a non-NULL image given no output to recycle.");
+        psFree(image6);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+    // Check for NULL input argument #1
+
+    if (0) {
+        psMemId id = psMemGetId();
+        psImage* image6 = (psImage*)psBinaryOp(image6, NULL, "+", image2);
+        ok(image6 == NULL, "psBinaryOp() returned a NULL result given a NULL first operand.");
+        psFree(image6);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+    // Check for NULL input argument #2
+    // Following should generate an error message
+    if (0) {
+        psMemId id = psMemGetId();
+        psImage* image6 = (psImage*)psBinaryOp(image6, image1, "+", NULL);
+        ok(image6 == NULL, "psBinaryOp() returned a NULL given a NULL second operand.");
+        psFree(image6);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+    // Check for NULL operand
+    // Following should generate an error message
+    if (0) {
+        psMemId id = psMemGetId();
+        psImage* image6 = (psImage*)psBinaryOp(image6, image1, NULL, image2);
+        ok(image6 == NULL, "psBinaryOp returned a NULL given a NULL operator.");
+        psFree(image6);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+    // Check for null output
+    {
+        psMemId id = psMemGetId();
+        psImage* image6 = (psImage*)psUnaryOp(NULL, image1, "sin");
+        ok(image6 != NULL, "psUnaryOp produced an image given no output to recycle.");
+        psFree(image6);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+    // Check for NULL input arg
+    // Following should generate an error message
+    if (0) {
+        psMemId id = psMemGetId();
+        psImage* image6 = (psImage*)psUnaryOp(image6, NULL, "sin");
+        ok(image6 == NULL, "psUnaryOp returned a NULL given a NULL operand.");
+        psFree(image6);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+    // Check for NULL operand
+    // Following should generate an error message
+    if (0) {
+        psMemId id = psMemGetId();
+        psImage* image6 = (psImage*)psUnaryOp(image6, image1, NULL);
+        ok(image6 == NULL, "psUnaryOp returned a NULL operand.");
+        psFree(image6);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+    // Inconsistent element types
+    // Following should generate an error message
+    if (0) {
+        psMemId id = psMemGetId();
+        psImage* image6 = (psImage*)psBinaryOp(image6, image3, "+", image2);
+        ok(image6 == NULL, "psBinaryOp returned a NULL given operands of different types");
+        psFree(image6);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+    // Check unary op to convert to correct type
+    if (0) {
+        psMemId id = psMemGetId();
+        psImage* image6 = psImageCopy(image6,image2,PS_TYPE_F64);
+        image6 = (psImage*)psUnaryOp(image6, image3, "sin");
+        ok(!(image6 == NULL || image6->type.type != PS_TYPE_F32),
+           "psUnaryOp converted the type of the output.");
+        psFree(image6);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+    // Inconsistent element count
+    // Following should generate an error message
+    if (0) {
+        psMemId id = psMemGetId();
+        psImage* image6 = (psImage*)psBinaryOp(image6, image4, "+", image2);
+        ok(image6 == NULL, "psBinaryOp returned a NULL given operands of different sizes.");
+        psFree(image6);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+    // Inconsistent element in input and output
+    // XXX: This fails, but should work.
+    if (0) {
+        psMemId id = psMemGetId();
+        psImage* image6 = psImageCopy(image6,image2,PS_TYPE_F64);
+        image6 = (psImage*)psUnaryOp(image6, image4, "sin");
+        ok(!(image6 == NULL ||
+             image6->numCols != image6->numCols ||
+             image6->numRows != image6->numRows),"psUnaryOp resized the output.");
+        psFree(image6);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+    // Inconsistent size of input 1 and input 2
+    // Following should generate an error message
+    if (0) {
+        psMemId id = psMemGetId();
+        psImage* image6 = (psImage*)psBinaryOp(image6, vector1, "+", image2);
+        ok(image6 == NULL, "psBinaryOp returned a NULL given operands of different sizes.");
+        psFree(image6);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+    // Inconsistent size of input 1 and input 2
+    // Following should generate an error message
+    if (0) {
+        psMemId id = psMemGetId();
+        vector1->type.dimen = PS_DIMEN_TRANSV;
+        psImage* image6 = (psImage*)psBinaryOp(image6, vector1, "+", image2);
+        ok(image6 == NULL, "psBinaryOp returned a NULL given operands of different sizes.");
+        psFree(image6);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+    // Inconsistent dimensionality
+    // Following should generate an two error messages
+    if (0) {
+        psMemId id = psMemGetId();
+        psImage* image6 = psImageCopy(image6,image2,PS_TYPE_F64);
+        image6 = (psImage*)psUnaryOp(image6, vector2, "sin");
+        ok(image6 == NULL, "psUnaryOp returned NULL given wrong type out parameter.");
+        psFree(image6);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+    // Attempt to use min with complex numbers
+    // Following should generate error message
+    if (0) {
+        psMemId id = psMemGetId();
+        psImage* image6 = (psImage*)psBinaryOp(image6, image5, "min", image5);
+        ok(image6 == NULL, "psUnaryOp returned NULL with min of complex numbers");
+        psFree(image6);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+
+    // Attempt to use max with complex numbers
+    // Following should generate an error message
+    if (0) {
+        psMemId id = psMemGetId();
+        psImage* image6 = (psImage*)psBinaryOp(image6, image5, "max", image5);
+        ok(image6 == NULL, "psUnaryOp returned NULL with max of complex numbers");
+        psFree(image6);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+
+    // Invalid operation
+    // Following should generate an error messgae
+    if (0) {
+        psMemId id = psMemGetId();
+        psImage* image6 = (psImage*)psBinaryOp(image6, image1, "yarg", image2);
+        ok(image6 == NULL, "psBinaryOp returned NULL with invalid operator");
+        psFree(image6);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+    // Following should generate an error message
+    if (0) {
+        psMemId id = psMemGetId();
+        psImage* image6 = (psImage*)psUnaryOp(image6, image1, "yarg");
+        ok(image6 == NULL, "psUnaryOp returned NULL with invalid operator");
+        psFree(image6);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+    CREATE_AND_SET_VECTOR(vector4,F64,0,3);
+    CREATE_AND_SET_VECTOR(vector5,F64,0,3);
+
+    // Input parameter with dimension of PS_DIMEN_OTHER
+    // Following should generate an error message
+    if (0) {
+        psMemId id = psMemGetId();
+        vector4->type.dimen = PS_DIMEN_OTHER;
+        ok(psBinaryOp(NULL,vector4,"+",vector5) == NULL, "psBinaryOp should return null when input dimen PS_DIMEN_OTHER.");
+        vector4->type.dimen = PS_DIMEN_VECTOR;
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+    // Input parameter with dimension of PS_DIMEN_OTHER
+    // Following should generate an error message
+    if (0) {
+        psMemId id = psMemGetId();
+        vector4->type.dimen = PS_DIMEN_OTHER;
+        ok(psUnaryOp(NULL,vector4,"sin") == NULL, "psUnaryOp should return null when input dimen PS_DIMEN_OTHER");
+        vector4->type.dimen = PS_DIMEN_VECTOR;
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+    psFree(vector4);
+    psFree(vector5);
+    psFree(image1);
+    psFree(image2);
+    psFree(image3);
+    psFree(image4);
+    psFree(image5);
+    psFree(vector1);
+    psFree(vector2);
+    ok(!psMemCheckLeaks (idGlobal, NULL, NULL, false), "no memory leaks");
+}
+
Index: /trunk/psLib/test/math/tap_psMatrixVectorArithmetic04.c
===================================================================
--- /trunk/psLib/test/math/tap_psMatrixVectorArithmetic04.c	(revision 10945)
+++ /trunk/psLib/test/math/tap_psMatrixVectorArithmetic04.c	(revision 10945)
@@ -0,0 +1,234 @@
+/** @file  tst_psMatrixVectorArithmetic04.c
+ *
+ *  @brief Test driver for psBinary arithmetic operations with scalars
+ *
+ *  This test driver will test the following binary operation with scalar inputs
+ *        vector addition with scalar in first argument
+ *        image addition with scalar in second argument
+ *
+ * XXX: The scalar functions at the end are producing memory corruption errors
+ * when they shouldn't.
+ *
+ * @author  Eric Van Alst, MHPCC
+ *
+ * @version $Revision: 1.1 $  $Name: not supported by cvs2svn $
+ * @date  $Date: 2007-01-06 00:48:54 $
+ *
+ * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
+ *
+ */
+#include <stdio.h>
+#include <string.h>
+#include <pslib.h>
+#include "tap.h"
+#include "pstap.h"
+
+
+// Create vector
+#define CREATE_AND_SET_VECTOR(NAME,TYPE,VALUE,SIZE) \
+psVector *NAME = psVectorAlloc(SIZE,PS_TYPE_##TYPE); \
+for(psS32 i=0; i<SIZE; i++) { \
+    NAME->data.TYPE[i] = VALUE; \
+} \
+NAME->n = SIZE;
+
+// Create image
+#define CREATE_AND_SET_IMAGE(NAME,TYPE,VALUE,NROWS,NCOLS) \
+psImage *NAME = psImageAlloc(NCOLS,NROWS,PS_TYPE_##TYPE); \
+for(psS32 i=0; i<NAME->numRows; i++) { \
+    for(psS32 j=0; j<NAME->numCols; j++) { \
+        NAME->data.TYPE[i][j] = VALUE; \
+    } \
+}
+
+psS32 main(psS32 argc, char* argv[])
+{
+    psLogSetFormat("HLNM");
+    plan_tests(12);
+
+    // testBinOpScalarFirst(void)
+    {
+        psMemId id = psMemGetId();
+        bool psErrorFlag = false;
+        CREATE_AND_SET_VECTOR(vector1,S8,1,5)
+        CREATE_AND_SET_VECTOR(vector2,S8,0,5)
+        psScalar* inScalar1 = psScalarAlloc(2,PS_TYPE_S8);
+
+        // Add vector and scalar
+        vector2 = (psVector*)psBinaryOp(vector2,inScalar1,"+",vector1);
+        // Verify the result vector
+        for(psS32 i=0; i<vector2->n; i++)
+        {
+            if(vector2->data.S8[i] != 3 ) {
+                psErrorFlag = true;
+                diag("Unexpected value in return vector[%d]",i);
+            }
+        }
+        ok(!psErrorFlag, "psBinaryOp() produced the correct vector");
+        psFree(vector1);
+        psFree(vector2);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+
+    {
+        psMemId id = psMemGetId();
+        bool psErrorFlag = false;
+        CREATE_AND_SET_VECTOR(vector3,S8,1,5);
+        CREATE_AND_SET_VECTOR(vector4,S8,0,3);
+
+        psScalar* inScalar2 = psScalarAlloc(2,PS_TYPE_S8);
+        vector4->type.dimen = PS_DIMEN_TRANSV;
+        vector4 = (psVector*)psBinaryOp(vector4,inScalar2,"+",vector3);
+        for(psS32 i=0; i<vector4->n; i++)
+        {
+            if(vector4->data.S8[i] != 3 ) {
+                psErrorFlag = true;
+                diag("Unexpected value in return vector[%d]",i);
+            }
+        }
+        ok(!psErrorFlag, "psBinaryOp() produced the correct vector");
+        psFree(vector3);
+        psFree(vector4);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+
+    {
+        psMemId id = psMemGetId();
+        bool psErrorFlag = false;
+        CREATE_AND_SET_IMAGE(image1,S8,1,5,5)
+        psImage* image2 = NULL;
+        psScalar* inScalar3 = psScalarAlloc(2,PS_TYPE_S8);
+
+        image2 = (psImage*)psBinaryOp(image2,inScalar3,"+",image1);
+        for(psS32 i=0; i<image2->numRows; i++)
+        {
+            for(psS32 j=0; j<image2->numCols; j++) {
+                if(image2->data.S8[i][j] != 3 ) {
+                    psErrorFlag = true;
+                    diag("Unexpected value in return image[%d][%d]",i,j);
+                }
+            }
+        }
+        ok(!psErrorFlag, "psBinaryOp() produced the correct matrix");
+        psFree(image1);
+        psFree(image2);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+
+    {
+        psMemId id = psMemGetId();
+        bool psErrorFlag = false;
+        CREATE_AND_SET_VECTOR(vector1,S8,1,5)
+        CREATE_AND_SET_VECTOR(vector2,S8,0,5)
+        psScalar* inScalar1 = psScalarAlloc(2,PS_TYPE_S8);
+
+        vector2 = (psVector*)psBinaryOp(vector2,vector1,"+",inScalar1);
+        for(psS32 i=0; i<vector2->n; i++)
+        {
+            if(vector2->data.S8[i] != 3 ) {
+                psErrorFlag = true;
+                diag("Unexpected value in return vector[%d]",i);
+            }
+        }
+        ok(!psErrorFlag, "psBinaryOp() produced the correct vector");
+        psFree(vector1);
+        psFree(vector2);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+
+    {
+        psMemId id = psMemGetId();
+        bool psErrorFlag = false;
+        CREATE_AND_SET_VECTOR(vector3,S8,1,5);
+        CREATE_AND_SET_VECTOR(vector4,S8,0,3);
+        psScalar* inScalar2 = psScalarAlloc(2,PS_TYPE_S8);
+
+        vector4->type.dimen = PS_DIMEN_TRANSV;
+        vector4 = (psVector*)psBinaryOp(vector4,vector3,"+",inScalar2);
+        for(psS32 i=0; i<vector4->n; i++)
+        {
+            if(vector4->data.S8[i] != 3 ) {
+                psErrorFlag = true;
+                diag("Unexpected value in return vector[%d]",i);
+            }
+        }
+        ok(!psErrorFlag, "psBinaryOp() produced the correct vector");
+        psFree(vector3);
+        psFree(vector4);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+
+    if (1) {
+        psMemId id = psMemGetId();
+        bool psErrorFlag = false;
+        CREATE_AND_SET_IMAGE(image1,S8,1,5,5);
+        psImage* image2 = NULL;
+        psScalar* inScalar3 = psScalarAlloc(2,PS_TYPE_S8);
+
+        image2 = (psImage*)psBinaryOp(image2,image1,"+",inScalar3);
+        for(psS32 i=0; i<image2->numRows; i++) {
+            for(psS32 j=0; j<image2->numCols; j++) {
+                if(image2->data.S8[i][j] != 3 ) {
+                    psErrorFlag = true;
+                    diag("Unexpected value in return image[%d][%d]",i,j);
+                }
+            }
+        }
+        ok(!psErrorFlag, "psBinaryOp() produced the correct matrix");
+        psFree(image1);
+        psFree(image2);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+
+    // testBinOpScalarBoth
+    // This test fails.  It shouldn't.
+    if (0) {
+        psMemId id = psMemGetId();
+        psScalar* inScalar1 = psScalarAlloc(1,PS_TYPE_S8);
+        psScalar* inScalar2 = psScalarAlloc(2,PS_TYPE_S8);
+        psScalar* outScalar = psScalarAlloc(4,PS_TYPE_S8);
+
+        outScalar = (psScalar*)psBinaryOp(outScalar,inScalar1,"+",inScalar2);
+        ok(outScalar->data.S8 == 3, "psBinaryOp() produced the correct result");
+        psFree(outScalar);
+        psFree(inScalar1);
+        psFree(inScalar2);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+    // This test fails.  It shouldn't.
+    if (0) {
+        psMemId id = psMemGetId();
+        psScalar* inScalar3 = psScalarAlloc(10,PS_TYPE_S8);
+        psScalar* inScalar4 = psScalarAlloc(20,PS_TYPE_S8);
+        psScalar* outScalar1 = NULL;
+
+        outScalar1 = (psScalar*)psBinaryOp(outScalar1,inScalar3,"+",inScalar4);
+        ok(outScalar1->data.S8 == 30, "psBinaryOp() produced the correct result");
+        psFree(outScalar1);
+        psFree(inScalar3);
+        psFree(inScalar4);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+    // This test fails.  It shouldn't.
+    // testUnaryOpScalar
+    if (0) {
+        psMemId id = psMemGetId();
+        psScalar* inScalar = psScalarAlloc(-1,PS_TYPE_F32);
+        psScalar* outScalar = NULL;
+
+        outScalar = (psScalar*)psUnaryOp(outScalar,inScalar,"abs");
+        ok(outScalar->data.F32 == 1, "psUnaryOp() produced the correct result");
+        psFree(outScalar);
+        psFree(inScalar);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+}
+
Index: /trunk/psLib/test/math/tap_psMinimizeLMM.c
===================================================================
--- /trunk/psLib/test/math/tap_psMinimizeLMM.c	(revision 10945)
+++ /trunk/psLib/test/math/tap_psMinimizeLMM.c	(revision 10945)
@@ -0,0 +1,171 @@
+/*****************************************************************************
+    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.
+ *****************************************************************************/
+#include <stdio.h>
+#include <string.h>
+#include <pslib.h>
+#include "tap.h"
+#include "pstap.h"
+
+#define NUM_ITERATIONS 100
+#define ERR_TOL 1e-6
+#define NUM_DATA_POINTS 300
+#define NUM_PARAMS 3
+#define VERBOSE 0
+float expectedParm[NUM_PARAMS];
+
+
+float function(const psVector *params, const psVector *x)
+{
+    return params->data.F32[0] *
+           expf(- (PS_SQR(x->data.F32[0]) + PS_SQR(x->data.F32[1]) / 2.0 / PS_SQR(params->data.F32[1]))) +
+           params->data.F32[2];
+}
+
+void derivatives(psVector *deriv, const psVector *params, const psVector *x)
+{
+    deriv->data.F32[0] = expf(- (PS_SQR(x->data.F32[0]) + PS_SQR(x->data.F32[1]) / 2.0 / PS_SQR(params->data.F32[1])));
+    deriv->data.F32[1] = params->data.F32[0] * (PS_SQR(x->data.F32[0]) + PS_SQR(x->data.F32[1]) / 2.0 / PS_SQR(params->data.F32[1])) / params->data.F32[1] / params->data.F32[1] / params->data.F32[1] * expf(- (PS_SQR(x->data.F32[0]) + PS_SQR(x->data.F32[1]) / 2.0 / PS_SQR(params->data.F32[1])));
+    deriv->data.F32[2] = 1.0;
+}
+
+
+/*****************************************************************************
+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,
+              psVector *x)
+{
+    if ((deriv == NULL) || (params == NULL) || (x == NULL)) {
+        psError(PS_ERR_UNKNOWN, true, "deriv or params or x is NULL.\n");
+    }
+
+    derivatives(deriv, params, x);
+    return function(params, x);
+}
+
+#define NUM_ITER 10
+#define TOL  20.0
+psS32 main(psS32 argc, char* argv[])
+{
+    psLogSetFormat("HLNM");
+    psLogSetLevel(PS_LOG_INFO);
+    plan_tests(2);
+    // Test psMinimizationAlloc()
+    {
+        psMemId id = psMemGetId();
+        psMinimization *tmp = psMinimizationAlloc(NUM_ITER, TOL);
+        ok(tmp != NULL, "psMinimizationAlloc() returned non-NULL");
+        skip_start(tmp == NULL, 5, "Skipping tests because psMinimizationAlloc() failed");
+        ok(tmp->maxIter == NUM_ITER, "psMinimizationAlloc() properly set ->maxIter");
+        ok(tmp->tol == TOL, "psMinimizationAlloc() properly set ->tol");
+        ok(tmp->value == 0.0, "psMinimizationAlloc() properly set ->value");
+        ok(tmp->iter == 0, "psMinimizationAlloc() properly set ->iter (%d)", tmp->iter);
+        ok(isnan(tmp->lastDelta), "psMinimizationAlloc() properly set ->lastDelta (%f)", tmp->lastDelta);
+        skip_end();
+        psFree(tmp);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+    /*
+        // 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()
+    {
+        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 *errors = psVectorAlloc(NUM_DATA_POINTS, PS_TYPE_F32);
+        psVector *params = psVectorAlloc(NUM_PARAMS, PS_TYPE_F32);
+        psVector *trueParams = psVectorAlloc(NUM_PARAMS, PS_TYPE_F32);
+        bool tmpBool;
+        trueParams->data.F32[0] = 100.0;    // Normalisation
+        trueParams->data.F32[1] = 3.0;      // Width
+        trueParams->data.F32[2] = 10.0;     // Background
+
+        // Set parameters
+        for (long i = 0; i < NUM_PARAMS; i++)
+        {
+            // Ensure we're not starting right on the true value:
+            params->data.F32[i] = trueParams->data.F32[i] *
+                                  (1.0 - psRandomGaussian(rng) / 10.0);
+        }
+
+        for (long i = 0; i < NUM_DATA_POINTS; i++)
+        {
+            psVector *x = psVectorAlloc(2, PS_TYPE_F32);
+            x->data.F32[0] = 10.0 * psRandomUniform(rng) - 5.0;
+            x->data.F32[1] = 10.0 * psRandomUniform(rng) - 5.0;
+            ordinates->data[i] = x;
+            // Add some noise
+            coordinates->data.F32[i] = function(params, x) + 0.1 * (2.0 * psRandomGaussian(rng) - 1.0);
+            errors->data.F32[i] = 0.1;
+            if (VERBOSE) {
+                printf("Data %ld: (%f, %f) --> %f\n",
+                       i, x->data.F32[0], x->data.F32[1], coordinates->data.F32[i]);
+            }
+        }
+
+        tmpBool = psMinimizeLMChi2(min, NULL, params, NULL, ordinates, coordinates, errors,
+                                   (psMinimizeLMChi2Func)fitFunc);
+        ok(tmpBool, "psMinimizeLMChi2() suceeded");
+        skip_start(!tmpBool, 4, "Skipping tests because psMinimizeLMChi2() failed");
+
+        printf("Minimisation took %d iterations\n", min->iter);
+        printf("chi^2 at the minimum is %.3g\n", min->value);
+        for (long i = 0; i < NUM_PARAMS; i++)
+        {
+            printf("Parameter %ld at the minimum is %.3f, expected: %f\n", i,
+                   params->data.F32[i], trueParams->data.F32[i]);
+        }
+        float diff = 0.0;
+        for (long i = 0; i < NUM_DATA_POINTS; i++)
+        {
+            psVector *x = ordinates->data[i];
+            float fitted = function(trueParams, x);
+            float expected = function(params, x);
+            diff += (fitted - expected) / fabsf(expected);
+            if (VERBOSE) {
+                printf("Data point %ld: Fitted: %f, expected: %f\n", i, fitted, expected);
+            }
+        }
+        printf("Mean relative difference is %f\n", diff/(float)NUM_DATA_POINTS);
+
+        psFree(min);
+        psFree(params);
+        psFree(trueParams);
+        psFree(ordinates);
+        psFree(coordinates);
+        psFree(errors);
+        psFree(rng);
+        skip_end();
+        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 10945)
+++ /trunk/psLib/test/math/tap_psMinimizePowell.c	(revision 10945)
@@ -0,0 +1,236 @@
+/*****************************************************************************
+    This routine must ensure that psMinimizePowell() works correctly.
+ 
+    XXX: This needs extensive work
+    XXX: We test with a NULL and non-NULL paramMask, however, the mask
+         has all zero values.
+    XXX: The tests that should generate errors are if'ed out.
+    XXX: psMinimizeChi2Powell() is untested.
+    XXX: Also, the test currently fails because of memory corruption in
+         psMinimizePowell().
+ *****************************************************************************/
+#include <stdio.h>
+#include <string.h>
+#include <pslib.h>
+#include "tap.h"
+#include "pstap.h"
+
+#define N 5
+#define MIN_VALUE 20.0
+#define NUM_PARAMS 10
+#define ERROR_TOLERANCE 0.10
+float expectedParm[NUM_PARAMS];
+psS32 testStatus = true;
+
+/*****************************************************************************
+myFunc(): This routine subtracts the associate value in expectedParm[] from
+each parameter and then squares it, then sums that for all parameters, then
+adds MIN_VALUE to it.  The minimum for this function will be MIN_VALUE, and
+will occur when each parameter equals the associated value in expectedParm[].
+ 
+This procedure ignores the coordinates, other than to ensure that they were
+passed correctly from psMinimizePowell().
+ *****************************************************************************/
+float myFunc(psVector *myParams,
+             psArray *myCoords)
+{
+    float sum = 0.0;
+    float coordData = 0.0;
+    float expData = 0.0;
+    psS32 i;
+
+    //
+    // Simply ensure that the coordinate data was passed correctly.
+    //
+    for (i=0;i<N;i++) {
+        coordData = ((psVector *) (myCoords->data[i]))->data.F32[0];
+        expData = (float) (i+10);
+        if (fabs(coordData - expData) > FLT_EPSILON) {
+            printf("ERROR(1): coordinate data was incorrectly passed to myFunc()\n");
+            printf("ERROR(1): was (%f) should be (%f)\n", coordData, expData);
+            testStatus = false;
+        }
+        coordData = ((psVector *) (myCoords->data[i]))->data.F32[1];
+        expData = (float) (i+3);
+        if (fabs(coordData - expData) > FLT_EPSILON) {
+            printf("ERROR(2): coordinate data was incorrectly passed to myFunc()\n");
+            printf("ERROR(2): was (%f) should be (%f)\n", coordData, expData);
+            testStatus = false;
+        }
+    }
+
+
+    sum = 0.0;
+    for (i=0;i<NUM_PARAMS;i++) {
+        sum+= (myParams->data.F32[i] - expectedParm[i]) * (myParams->data.F32[i] - expectedParm[i]);
+    }
+    sum = MIN_VALUE + (sum * sum);
+
+    return(sum);
+}
+
+
+psS32 main()
+{
+    psLogSetFormat("HLNM");
+    plan_tests(2);
+
+    // 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);
+        psMinimization *min = psMinimizationAlloc(100, 0.01);
+        psArray *myCoords = psArrayAlloc(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);
+            ((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++;
+        }
+
+        // Following should generate error for null minimize
+        if (0)
+        {
+            psMinimizePowell(NULL, myParams, myParamMask, myCoords, (psMinimizePowellFunc) myFunc);
+        }
+
+        // Following should generate error for null parameter vector
+        if (0)
+        {
+            psMinimizePowell(min, NULL, myParamMask, myCoords,(psMinimizePowellFunc) myFunc);
+        }
+
+        // Following should generate error for null coords
+        if (0)
+        {
+            psMinimizePowell(min, myParams, myParamMask, NULL, (psMinimizePowellFunc) myFunc);
+        }
+
+        // Following should generate error for null function
+        if (0)
+        {
+            psMinimizePowell(min, myParams, myParamMask, myCoords, NULL);
+        }
+
+        psFree(myParams);
+        psFree(myParamMask);
+        psFree(min);
+        psFree(myCoords);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+    // Powell minimize with parameter mask
+    {
+        psMemId id = psMemGetId();
+        psVector *myParams = psVectorAlloc(NUM_PARAMS, PS_TYPE_F32);
+        psMinimization *min = psMinimizationAlloc(100, 0.01);
+        psArray *myCoords = psArrayAlloc(N);
+        psVector *myParamMask = psVectorAlloc(NUM_PARAMS, PS_TYPE_U8);
+
+        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;
+            myParamMask->data.U8[i] = 0;
+        }
+
+        bool tmpBool = psMinimizePowell(min, myParams, myParamMask, 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(myParamMask);
+        psFree(min);
+        skip_end();
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+    // Powell minimize with parameter mask
+    // The only difference from the previous block is that paramMask is now NULL
+    {
+        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");
+    }
+}
Index: /trunk/psLib/test/math/tap_psRandom.c
===================================================================
--- /trunk/psLib/test/math/tap_psRandom.c	(revision 10945)
+++ /trunk/psLib/test/math/tap_psRandom.c	(revision 10945)
@@ -0,0 +1,378 @@
+/*****************************************************************************
+This routine must ensure that the various random number generator functions
+work properly.
+ 
+    ensure that psRandom structs are properly allocated by psRandomAlloc().
+    ensure that psRandomUniform() produces a sequence of numbers with
+        proper mean and stdev.
+    ensure that psRandomGaussian() produces a sequence of numbers with
+        proper mean and stdev.
+    ensure that psRandomPoisson() produces a sequence of numbers with
+        proper mean and stdev.
+    ensure that psRandomReset() properly seeds the random number
+        generator for psRandomUniform().
+    ensure that psRandomReset() properly seeds the random number
+        generator for psRandomGaussian().
+    ensure that psRandomReset() properly seeds the random number
+        generator for psRandomPoisson().
+ 
+XXX: I removed a test that generated error output.  How should we test that?
+ *****************************************************************************/
+#include <stdio.h>
+#include <string.h>
+#include <pslib.h>
+#include "tap.h"
+#include "pstap.h"
+#include <math.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+#define NUM_DATA 10000
+#define SEED 54321
+#define SEED2 345
+#define UNIFORM_MEAN 0.5
+#define UNIFORM_STDEV 0.3
+#define GAUSSIAN_MEAN 0.0
+#define GAUSSIAN_STDEV 1.0
+#define POISSON_MEAN 15.0
+#define POISSON_STDEV (POISSON_MEAN / 4)
+#define ERROR_TOLERANCE 0.2
+#define VERBOSE 0
+# define ok_float_tol_per(VALUE,EXPECT,TOL,COMMENT, ...)\
+ok((fabs((VALUE)-(EXPECT)) < (TOL)), COMMENT, ## __VA_ARGS__);
+
+psS32 main(psS32 argc, char* argv[])
+{
+    psLogSetFormat("HLNM");
+    plan_tests(34);
+
+    diag("ensure that psRandom structs are properly allocated by psRandomAlloc()");
+    // ensure that psRandom structs are properly allocated by psRandomAlloc()
+    {
+        psMemId id = psMemGetId();
+        // Valid type allocation
+        psRandom *myRNG = psRandomAlloc(PS_RANDOM_TAUS, SEED);
+        ok(myRNG != NULL, "psRandom struct was allocated properly");
+        skip_start(myRNG == NULL, 1, "Skipping tests because psRandomAlloc() failed");
+        ok(myRNG->type == PS_RANDOM_TAUS, "psRandomAlloc() set type properly");
+        psFree(myRNG);
+        skip_end();
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+    // Unallowed type allocation
+    {
+        psMemId id = psMemGetId();
+        psRandom *myRNG = psRandomAlloc(100,SEED);
+        ok(myRNG == NULL, "psRandomAlloc() refused to generate psRandom with unallowed type");
+        psFree(myRNG);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+    // Negative seed value
+    {
+        psMemId id = psMemGetId();
+        psRandom *myRNG = psRandomAlloc(PS_RANDOM_TAUS,-5);
+        ok(myRNG != NULL, "psRandomAlloc() allows negative seed");
+        psFree(myRNG);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+    // testRandomUniform(void)
+    {
+        diag("testRandomUniform()");
+        psMemId id = psMemGetId();
+        psVector *rans = psVectorAlloc(NUM_DATA, PS_TYPE_F64);
+        rans->n = rans->nalloc;
+        psStats *stats = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
+        psRandom *myRNG = psRandomAlloc(PS_RANDOM_TAUS, SEED);
+        ok(myRNG != NULL, "psRandom struct was allocated properly");
+        skip_start(myRNG == NULL, 2, "Skipping tests because psRandomAlloc() failed");
+
+        // Initialize vector data with random number
+        for (psS32 i = 0 ; i < NUM_DATA ; i++)
+        {
+            rans->data.F64[i] = psRandomUniform(myRNG);
+        }
+
+        // Perform vector stats on random data (mean, stdev)
+        stats = psVectorStats(stats, rans, NULL, NULL, 0);
+        stats->options = PS_STAT_SAMPLE_STDEV;
+        stats = psVectorStats(stats, rans, NULL, NULL, 0);
+
+        // Verify mean and stdev
+        ok_float_tol_per(stats->sampleMean, UNIFORM_MEAN, ERROR_TOLERANCE, "Mean is within expected range");
+        ok_float_tol_per(stats->sampleStdev, UNIFORM_STDEV, ERROR_TOLERANCE, "StDev is within expected range");
+
+        skip_end();
+
+        psFree(myRNG);
+        psFree(rans);
+        psFree(stats);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+    // Ensure psRandomUniform() returns 0 for NULL psRandom struct
+    {
+        psMemId id = psMemGetId();
+        ok(psRandomUniform(NULL) == 0, "Ensure psRandomUniform() returns 0 for NULL psRandom struct");
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+    // testRandomGaussian(void)
+    {
+        diag("testRandomGaussian()");
+        psMemId id = psMemGetId();
+        psVector *rans = psVectorAlloc(NUM_DATA, PS_TYPE_F64);
+        rans->n = rans->nalloc;
+        psStats *stats = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
+        psRandom *myRNG = psRandomAlloc(PS_RANDOM_TAUS, SEED);
+        ok(myRNG != NULL, "psRandom struct was allocated properly");
+        skip_start(myRNG == NULL, 2, "Skipping tests because psRandomAlloc() failed");
+
+        // Initialize vector with random data
+        for (psS32 i = 0 ; i < NUM_DATA ; i++)
+        {
+            rans->data.F64[i] = psRandomGaussian(myRNG);
+        }
+
+        // Perform vector stats on data (mean, stdev)
+        stats = psVectorStats(stats, rans, NULL, NULL, 0);
+        stats->options = PS_STAT_SAMPLE_STDEV;
+        stats = psVectorStats(stats, rans, NULL, NULL, 0);
+
+        // Verify mean and stdev
+        ok_float_tol_per(stats->sampleMean, GAUSSIAN_MEAN, ERROR_TOLERANCE, "Mean is within expected range");
+        ok_float_tol_per(stats->sampleStdev, GAUSSIAN_STDEV, ERROR_TOLERANCE, "StDev is within expected range");
+
+        skip_end();
+
+        psFree(myRNG);
+        psFree(rans);
+        psFree(stats);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+
+    // Ensure psRandomGaussian() returns 0 for NULL psRandom struct
+    {
+        psMemId id = psMemGetId();
+        ok(psRandomGaussian(NULL) == 0, "Ensure psRandomGaussian() returns 0 for NULL psRandom struct");
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+
+    // testRandomPoisson(void)
+    {
+        diag("testRandomPoisson()");
+        psMemId id = psMemGetId();
+        psVector *rans = psVectorAlloc(NUM_DATA, PS_TYPE_F64);
+        rans->n = rans->nalloc;
+        psStats *stats = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
+        psRandom *myRNG = psRandomAlloc(PS_RANDOM_TAUS, SEED);
+        ok(myRNG != NULL, "psRandom struct was allocated properly");
+        skip_start(myRNG == NULL, 2, "Skipping tests because psRandomAlloc() failed");
+
+        // Initialize vector with random data
+        for (psS32 i = 0 ; i < NUM_DATA ; i++)
+        {
+            rans->data.F64[i] = psRandomPoisson(myRNG, POISSON_MEAN);
+        }
+
+        // Perform vector stats on random data (mean, stdev)
+        stats = psVectorStats(stats, rans, NULL, NULL, 0);
+        stats->options = PS_STAT_SAMPLE_STDEV;
+        stats = psVectorStats(stats, rans, NULL, NULL, 0);
+        // Verify mean and stdev
+        ok_float_tol_per(stats->sampleMean, POISSON_MEAN, ERROR_TOLERANCE, "Mean is within expected range");
+        ok_float_tol_per(stats->sampleStdev, POISSON_STDEV, ERROR_TOLERANCE, "StDev is within expected range");
+
+        skip_end();
+
+        psFree(myRNG);
+        psFree(rans);
+        psFree(stats);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+    // Ensure psRandomPoisson() returns 0 for NULL psRandom struct
+    {
+        psMemId id = psMemGetId();
+        ok(psRandomPoisson(NULL, POISSON_MEAN) == 0, "Ensure psRandomPoisson() returns 0 for NULL psRandom struct");
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+    // testRandomResetUniform(void)
+    {
+        diag("testRandomUniform(): ensure the seed resets properly");
+        psMemId id = psMemGetId();
+        psVector *rans00 = psVectorAlloc(NUM_DATA, PS_TYPE_F64);
+        rans00->n = rans00->nalloc;
+        psVector *rans01 = psVectorAlloc(NUM_DATA, PS_TYPE_F64);
+        rans01->n = rans01->nalloc;
+        psVector *rans02 = psVectorAlloc(NUM_DATA, PS_TYPE_F64);
+        rans02->n = rans02->nalloc;
+
+        psRandom *myRNG = psRandomAlloc(PS_RANDOM_TAUS, SEED);
+        ok(myRNG != NULL, "psRandom struct was allocated properly");
+        skip_start(myRNG == NULL, 1, "Skipping tests because psRandomAlloc() failed");
+
+
+        // Random reset
+        psRandomReset(myRNG, SEED);
+        for (psS32 i = 0 ; i < NUM_DATA ; i++)
+        {
+            rans00->data.F64[i] = psRandomUniform(myRNG);
+        }
+        psRandomReset(myRNG, SEED2);
+        for (psS32 i = 0 ; i < NUM_DATA ; i++)
+        {
+            rans01->data.F64[i] = psRandomUniform(myRNG);
+        }
+        psRandomReset(myRNG, SEED);
+        for (psS32 i = 0 ; i < NUM_DATA ; i++)
+        {
+            rans02->data.F64[i] = psRandomUniform(myRNG);
+        }
+
+        // Verify reset to original seed produces same results
+        psBool errorFlag = false;
+        for (psS32 i = 0 ; i < NUM_DATA ; i++)
+        {
+            if (rans00->data.F64[i] != rans02->data.F64[i]) {
+                if (VERBOSE) {
+                    psError(PS_ERR_UNKNOWN,true,"psRandomUniform did not produce the same results with the same seed");
+                }
+                errorFlag = true;
+            }
+        }
+        ok(!errorFlag, "psRandomUniform() produced the same results with the same seed");
+        skip_end();
+        psFree(myRNG);
+        psFree(rans00);
+        psFree(rans01);
+        psFree(rans02);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+    // XXX: How to test the proper generation of error messages?
+    if (0) {
+        psRandom *myRNG1 = NULL;
+        myRNG1 = psRandomAlloc(PS_RANDOM_TAUS, SEED);
+        //    psLogSetDestination("dest:stderr");
+        psLogSetDestination(0);
+        psRandomReset(myRNG1,0);
+        //    psLogSetDestination("dest:stderr");
+        psLogSetDestination(2);
+        psFree(myRNG1);
+
+        psLogMsg(__func__,PS_LOG_INFO,"Reset a NULL psRandom variable, should generate an error message");
+        psRandomReset(NULL,SEED);
+    }
+
+    // testRandomResetGaussian(void)
+    {
+        diag("testRandomGaussian(): ensure the seed resets properly");
+        psMemId id = psMemGetId();
+        psVector *rans00 = psVectorAlloc(NUM_DATA, PS_TYPE_F64);
+        rans00->n = rans00->nalloc;
+        psVector *rans01 = psVectorAlloc(NUM_DATA, PS_TYPE_F64);
+        rans01->n = rans01->nalloc;
+        psVector *rans02 = psVectorAlloc(NUM_DATA, PS_TYPE_F64);
+        rans02->n = rans02->nalloc;
+
+        psRandom *myRNG = psRandomAlloc(PS_RANDOM_TAUS, SEED);
+        ok(myRNG != NULL, "psRandom struct was allocated properly");
+        skip_start(myRNG == NULL, 1, "Skipping tests because psRandomAlloc() failed");
+
+
+        // Initialize random data in vectors
+        psRandomReset(myRNG, SEED);
+        for (psS32 i = 0 ; i < NUM_DATA ; i++)
+        {
+            rans00->data.F64[i] = psRandomGaussian(myRNG);
+        }
+        psRandomReset(myRNG, SEED2);
+        for (psS32 i = 0 ; i < NUM_DATA ; i++)
+        {
+            rans01->data.F64[i] = psRandomGaussian(myRNG);
+        }
+        psRandomReset(myRNG, SEED);
+        for (psS32 i = 0 ; i < NUM_DATA ; i++)
+        {
+            rans02->data.F64[i] = psRandomGaussian(myRNG);
+        }
+
+        // Verify data from original seed produces same data after reset
+        psBool errorFlag = false;
+        for (psS32 i = 0 ; i < NUM_DATA ; i++)
+        {
+            if (rans00->data.F64[i] != rans02->data.F64[i]) {
+                if (VERBOSE) {
+                    psError(PS_ERR_UNKNOWN,true,"psRandomGaussian did not produce the same results with the same seed");
+                }
+                errorFlag = true;
+            }
+        }
+        ok(!errorFlag, "psRandomUniform() produced the same results with the same seed");
+        skip_end();
+        psFree(myRNG);
+        psFree(rans00);
+        psFree(rans01);
+        psFree(rans02);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+
+    // testRandomResetPoisson(void)
+    {
+        diag("testRandomPoisson(): ensure the seed resets properly");
+        psMemId id = psMemGetId();
+        psVector *rans00 = psVectorAlloc(NUM_DATA, PS_TYPE_F64);
+        rans00->n = rans00->nalloc;
+        psVector *rans01 = psVectorAlloc(NUM_DATA, PS_TYPE_F64);
+        rans01->n = rans01->nalloc;
+        psVector *rans02 = psVectorAlloc(NUM_DATA, PS_TYPE_F64);
+        rans02->n = rans02->nalloc;
+
+        psRandom *myRNG = psRandomAlloc(PS_RANDOM_TAUS, SEED);
+        ok(myRNG != NULL, "psRandom struct was allocated properly");
+        skip_start(myRNG == NULL, 1, "Skipping tests because psRandomAlloc() failed");
+
+        // Initialize vectors with random data
+        psRandomReset(myRNG, SEED);
+        for (psS32 i = 0 ; i < NUM_DATA ; i++)
+        {
+            rans00->data.F64[i] = psRandomPoisson(myRNG, POISSON_MEAN);
+        }
+        psRandomReset(myRNG, SEED2);
+        for (psS32 i = 0 ; i < NUM_DATA ; i++)
+        {
+            rans01->data.F64[i] = psRandomPoisson(myRNG, POISSON_MEAN);
+        }
+        psRandomReset(myRNG, SEED);
+        for (psS32 i = 0 ; i < NUM_DATA ; i++)
+        {
+            rans02->data.F64[i] = psRandomPoisson(myRNG, POISSON_MEAN);
+        }
+
+        // Verify the original seed produces same data after reset
+        psBool errorFlag = false;
+        for (psS32 i = 0 ; i < NUM_DATA ; i++)
+        {
+            if (rans00->data.F64[i] != rans02->data.F64[i]) {
+                if (VERBOSE) {
+                    psError(PS_ERR_UNKNOWN,true,"psRandomPoisson did not produce the same results with the same seed");
+                }
+                errorFlag = true;
+            }
+        }
+        ok(!errorFlag, "psRandomUniform() produced the same results with the same seed");
+        skip_end();
+        psFree(myRNG);
+        psFree(rans00);
+        psFree(rans01);
+        psFree(rans02);
+        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 10945)
+++ /trunk/psLib/test/math/tap_psSpline1D.c	(revision 10945)
@@ -0,0 +1,301 @@
+/* @file  tst_psImageManip.c
+*
+*  @brief This file will contain tests for all of the public psLib functions
+*         that implement 1-D spline functionality:
+* psSpline1DAlloc()
+* psSpline1DEval()
+* psSpline1DEvalVector()
+* psVectorFitSpline1D()
+*
+*         This file is composed of the tests formerly in tst_psFunc02.c,
+*         tst_psFunc03.c, tst_psFunc04.c, tst_psFunc05.c, and tst_psFunc07.c.
+*
+*  @author GLG, MHPCC
+*
+*  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2007-01-06 00:48:54 $
+*
+*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
+*/
+#include <stdio.h>
+#include <string.h>
+#include <pslib.h>
+#include "tap.h"
+#include "pstap.h"
+
+#define ERROR_TOLERANCE_PERCENT    1.00
+#define VERBOSE 0
+/*********************************************************************************
+CheckErrorF32(psF32 actual, psF32 expect): this routine returns FALSE if the
+actual and expect arguments are with ERROR_TOLERANCE_PERCENT of each other,
+otherwise it returns TRUE.
+ ********************************************************************************/
+psBool CheckErrorF32(
+    psF32 actual,
+    psF32 expect)
+{
+    if ((fabs(actual - expect) / fabs(expect)) > ERROR_TOLERANCE_PERCENT) {
+        return(true);
+    } else {
+        return(false);
+    }
+}
+/*********************************************************************************
+CheckErrorF64(psF64 actual, psF64 expect): this routine returns FALSE if the
+actual and expect arguments are with ERROR_TOLERANCE_PERCENT of each other,
+otherwise it returns TRUE.
+ ********************************************************************************/
+psBool CheckErrorF64(
+    psF64 actual,
+    psF64 expect)
+{
+    if ((fabs(actual - expect) / fabs(expect)) > ERROR_TOLERANCE_PERCENT) {
+        return(true);
+    } else {
+        return(false);
+    }
+}
+
+psF32 myFunc00(psF32 x)
+{
+    return(x);
+}
+
+psF64 myFunc00_F64(psF64 x)
+{
+    return(x);
+}
+
+#define A 4.0
+#define B -3.0
+#define C 0.2
+#define D 0.1
+psF32 myFunc01(psF32 x)
+{
+    return(A + x * (B + x * (C + x * (D))));
+}
+psF64 myFunc01_F64(psF64 x)
+{
+    return(A + x * (B + x * (C + x * (D))));
+}
+
+typedef psF32 (*mappingFuncF32)(psF32 x);
+typedef psF64 (*mappingFuncF64)(psF64 x);
+
+bool genericF32Test(psS32 NumSplines, mappingFuncF32 func, bool xNull)
+{
+    // We test the psVectorFitSpline1D, psSpline1DEval() functions.  F32 version.
+    bool testStatus = true;
+    {
+        psMemId id = psMemGetId();
+        psVector *xF32 = psVectorAlloc(NumSplines+1, PS_TYPE_F32);
+        psVector *yF32 = psVectorAlloc(NumSplines+1, PS_TYPE_F32);
+        for (psS32 i=0;i<NumSplines+1;i++) {
+            xF32->data.F32[i] = (psF32) i;
+            yF32->data.F32[i] = (psF32) func((psF32) i);
+        }
+
+        psSpline1D *tmpSpline = NULL;
+        if (!xNull) {
+            tmpSpline = psVectorFitSpline1D(xF32, yF32);
+        } else {
+            tmpSpline = psVectorFitSpline1D(NULL, yF32);
+        }
+        if(tmpSpline == NULL) {
+            diag("psVectorFitSpline1D() returned NULL");
+            testStatus = false;
+        } else {
+            if (tmpSpline->n != NumSplines) {
+                diag("psVectorFitSpline1D() did not properly set the psSpline1D->n member");
+                testStatus = false;
+            }
+            if(tmpSpline->spline == NULL) {
+                diag("psVectorFitSpline1D() returned a NULL psSpline1D->spline member.");
+                testStatus = false;
+            }
+            for (psS32 i = 0 ; i < NumSplines ; i++) {
+                if (tmpSpline->spline[i] == NULL) {
+                    diag("psVectorFitSpline1D() returned a NULL psSpline1D->spline[%d] member.", i);
+                    testStatus = false;
+                }
+            }
+            if (tmpSpline->knots == NULL) {
+                diag("psVectorFitSpline1D() returned a NULL psSpline1D->knots member");
+                testStatus = false;
+            }
+            if (tmpSpline->p_psDeriv2 == NULL) {
+                diag("psVectorFitSpline1D()returned a NULL psSpline1D->p_psDeriv2 member");
+                testStatus = false;
+            }
+
+            // Test psSpline1DEval()
+            for (psS32 i=0;i<NumSplines;i++) {
+                psF32 x = 0.5 + (float) i;
+                psF32 y = psSpline1DEval(tmpSpline, x);
+                if (CheckErrorF32(y, func(x))) {
+                    testStatus = false;
+                    diag("TEST ERROR: f(%f) is %f, should be %f", x, y, myFunc00(x));
+                }
+            }
+
+            // Test psSpline1DEvalVector()
+            psVector *yF32Test = psSpline1DEvalVector(tmpSpline, xF32);
+            if (yF32Test == NULL) {
+                testStatus = false;
+                diag("TEST ERROR: psSpline1DEvalVector() returned NULL");
+            } else {
+                for (psS32 i=0;i<NumSplines;i++) {
+                    if (CheckErrorF32(yF32Test->data.F32[i], func(xF32->data.F32[i]))) {
+                        testStatus = false;
+                        diag("TEST ERROR: f(%f) is %f, should be %f", xF32->data.F32[i],
+                             yF32Test->data.F32[i], myFunc00(xF32->data.F32[i]));
+                    }
+                }
+                psFree(yF32Test);
+            }
+        }
+
+        psFree(tmpSpline);
+        psFree(xF32);
+        psFree(yF32);
+        if (psMemCheckLeaks (id, NULL, NULL, false)) {
+            diag("TEST ERROR: memory leaks");
+            testStatus = false;
+        }
+    }
+    return(testStatus);
+}
+
+
+// This is a duplicate cut-n-paste of the F32 function
+bool genericF64Test(psS32 NumSplines, mappingFuncF64 func, bool xNull)
+{
+    // We test the psVectorFitSpline1D, psSpline1DEval() functions.  F64 version.
+    bool testStatus = true;
+    {
+        psMemId id = psMemGetId();
+        psVector *xF64 = psVectorAlloc(NumSplines+1, PS_TYPE_F64);
+        psVector *yF64 = psVectorAlloc(NumSplines+1, PS_TYPE_F64);
+        for (psS32 i=0;i<NumSplines+1;i++) {
+            xF64->data.F64[i] = (psF64) i;
+            yF64->data.F64[i] = (psF64) func((psF64) i);
+        }
+
+        psSpline1D *tmpSpline = NULL;
+        if (!xNull) {
+            tmpSpline = psVectorFitSpline1D(xF64, yF64);
+        } else {
+            tmpSpline = psVectorFitSpline1D(NULL, yF64);
+        }
+        if(tmpSpline == NULL) {
+            diag("psVectorFitSpline1D() returned NULL");
+            testStatus = false;
+        } else {
+            if (tmpSpline->n != NumSplines) {
+                diag("psVectorFitSpline1D() did not properly set the psSpline1D->n member");
+                testStatus = false;
+            }
+            if(tmpSpline->spline == NULL) {
+                diag("psVectorFitSpline1D() returned a NULL psSpline1D->spline member.");
+                testStatus = false;
+            }
+            for (psS32 i = 0 ; i < NumSplines ; i++) {
+                if (tmpSpline->spline[i] == NULL) {
+                    diag("psVectorFitSpline1D() returned a NULL psSpline1D->spline[%d] member.", i);
+                    testStatus = false;
+                }
+            }
+            if (tmpSpline->knots == NULL) {
+                diag("psVectorFitSpline1D() returned a NULL psSpline1D->knots member");
+                testStatus = false;
+            }
+            if (tmpSpline->p_psDeriv2 == NULL) {
+                diag("psVectorFitSpline1D()returned a NULL psSpline1D->p_psDeriv2 member");
+                testStatus = false;
+            }
+
+            // Test psSpline1DEval()
+            for (psS32 i=0;i<NumSplines;i++) {
+                psF64 x = 0.5 + (float) i;
+                psF64 y = psSpline1DEval(tmpSpline, x);
+                if (CheckErrorF64(y, func(x))) {
+                    testStatus = false;
+                    diag("TEST ERROR psSpline1DEval(): f(%f) is %f, should be %f", x, y, myFunc00(x));
+                }
+            }
+
+            // Test psSpline1DEvalVector()
+            psVector *yF64Test = psSpline1DEvalVector(tmpSpline, xF64);
+            if (yF64Test == NULL) {
+                testStatus = false;
+                diag("TEST ERROR: psSpline1DEvalVector() returned NULL");
+            } else {
+                for (psS32 i=0;i<NumSplines;i++) {
+                    if (CheckErrorF64((psF64)yF64Test->data.F32[i], func(xF64->data.F64[i]))) {
+                        testStatus = false;
+                        diag("TEST ERROR psSpline1DEvalVector(): f(%f) is %f, should be %f", xF64->data.F64[i],
+                             yF64Test->data.F32[i], myFunc00(xF64->data.F64[i]));
+                    }
+                }
+                psFree(yF64Test);
+            }
+        }
+
+        psFree(tmpSpline);
+        psFree(xF64);
+        psFree(yF64);
+        if (psMemCheckLeaks (id, NULL, NULL, false)) {
+            diag("TEST ERROR: memory leaks");
+            testStatus = false;
+        }
+    }
+    return(testStatus);
+}
+
+psS32 main(psS32 argc, char* argv[])
+{
+    psLogSetFormat("HLNM");
+    psLogSetLevel( PS_LOG_INFO );
+
+    plan_tests(24);
+    // psSplineAllocTest()
+    {
+        psMemId id = psMemGetId();
+        psSpline1D *tmpSpline = psSpline1DAlloc();
+        ok(tmpSpline != NULL, "psSpline1DAlloc() returned non-NULL");
+        skip_start(tmpSpline == NULL, 4, "Skipping tests because psSpline1DAlloc() failed");
+        ok(tmpSpline->n == 0, "psSpline1DAlloc() properly set the psSpline1D->n member");
+        ok(tmpSpline->spline == NULL, "psSpline1DAlloc() properly set the psSpline1D->spline member");
+        ok(tmpSpline->knots == NULL, "psSpline1DAlloc() properly set the psSpline1D->knots member");
+        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");
+    }
+
+    // psSplineEvalTest_sub(): Call psVectorFitSpline1D with NULL arguments.
+    {
+        psMemId id = psMemGetId();
+        psSpline1D *tmpSpline = psVectorFitSpline1D(NULL, NULL);
+        ok(tmpSpline == NULL, "psVectorFitSpline1D() returns NULL with NULL arguments");
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+    ok(genericF32Test(1, myFunc00, false), "Generic, simple mapping, F32 test. 1 spline");
+    ok(genericF32Test(95, myFunc00, false), "Generic, simple mapping, F32 test. 95 splines");
+    ok(genericF32Test(1, myFunc01, false), "Generic, simple mapping, F32 test. 1 spline");
+    ok(genericF32Test(95, myFunc01, false), "Generic, simple mapping, F32 test. 95 splines");
+    ok(genericF32Test(1, myFunc00, true), "Generic, simple mapping, F32 test. 1 spline");
+    ok(genericF32Test(95, myFunc00, true), "Generic, simple mapping, F32 test. 95 splines");
+    ok(genericF32Test(1, myFunc01, true), "Generic, simple mapping, F32 test. 1 spline");
+    ok(genericF32Test(95, myFunc01, true), "Generic, simple mapping, F32 test. 95 splines");
+    ok(genericF64Test(1, myFunc00_F64, false), "Generic, simple mapping, F64 test. 1 spline");
+    ok(genericF64Test(95, myFunc00_F64, false), "Generic, simple mapping, F64 test. 95 splines");
+    ok(genericF64Test(1, myFunc01_F64, false), "Generic, simple mapping, F64 test. 1 spline");
+    ok(genericF64Test(95, myFunc01_F64, false), "Generic, simple mapping, F64 test. 95 splines");
+    ok(genericF64Test(1, myFunc00_F64, true), "Generic, simple mapping, F64 test. 1 spline");
+    ok(genericF64Test(95, myFunc00_F64, true), "Generic, simple mapping, F64 test. 95 splines");
+    ok(genericF64Test(1, myFunc01_F64, true), "Generic, simple mapping, F64 test. 1 spline");
+    ok(genericF64Test(95, myFunc01_F64, true), "Generic, simple mapping, F64 test. 95 splines");
+}
