Index: /trunk/psLib/test/dataManip/tst_psMatrix07.c
===================================================================
--- /trunk/psLib/test/dataManip/tst_psMatrix07.c	(revision 3290)
+++ /trunk/psLib/test/dataManip/tst_psMatrix07.c	(revision 3291)
@@ -16,6 +16,6 @@
  *  @author  Ross Harman, MHPCC
  *
- *  @version $Revision: 1.9 $  $Name: not supported by cvs2svn $
- *  @date  $Date: 2005-02-17 19:26:25 $
+ *  @version $Revision: 1.10 $  $Name: not supported by cvs2svn $
+ *  @date  $Date: 2005-02-19 00:43:32 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -39,5 +39,5 @@
         } else if(IMAGE->type.type == PS_TYPE_F32){                                                      \
             if(fabs(IMAGE->data.F32[i][j]-TRUTH[i][j]) > TOLERANCE) {                                    \
-                printf("Matrix values at element %d, %d don't agree %f vs %lf\n", i, j,                  \
+                printf("Matrix values at element %d, %d don't agree %f vs %f\n", i, j,                  \
                        IMAGE->data.F32[i][j], TRUTH[i][j]);                                              \
             }                                                                                            \
@@ -54,5 +54,5 @@
         }                                                                                                \
     } else if(VECTOR->type.type == PS_TYPE_F32){                                                         \
-        if(fabs(VECTOR->data.F32[i]-truthVector[i]) > TOLERANCE) {                                       \
+        if(fabs(VECTOR->data.F32[i]-truthVector_32[i]) > TOLERANCE) {                                       \
             printf("Vector values at element %d don't agree %f vs %lf\n", i,                             \
                    VECTOR->data.F32[i], truthVector[i]);                                                 \
@@ -65,38 +65,66 @@
 {
     psVector *v1 = NULL;
+    psVector *v1_32 = NULL;
     psVector *tempVector = NULL;
+    psVector *tempVector_32 = NULL;
     psImage *tempImage = NULL;
+    psImage *tempImage_32 = NULL;
     psImage *m1 = NULL;
+    psImage *m1_32 = NULL;
     psVector *v2 = NULL;
+    psVector *v2_32 = NULL;
     psVector *v3 = NULL;
+    psVector *v3_32 = NULL;
     psImage *m2 = NULL;
+    psImage *m2_32 = NULL;
     psImage *m3 = NULL;
+    psImage *m3_32 = NULL;
     psImage *m4 = NULL;
+    psImage *m4_32 = NULL;
     psImage *badImage = NULL;
-
-    double truthVector[3] = {0.0, 1.0, 2.0};
-    double truthMatrix[3][1] = {{0.0}, {1.0}, {2.0}};
+    psImage *badImage_32 = NULL;
+
+    psF64 truthVector[3] = {0.0, 1.0, 2.0};
+    psF32 truthVector_32[3] = {0.0, 1.0, 2.0};
+    psF64 truthMatrix[3][1] = {{0.0}, {1.0}, {2.0}};
+    psF32 truthMatrix_32[3][1] = {{0.0}, {1.0}, {2.0}};
 
     // Test A - Create input and output images
     printPositiveTestHeader(stdout, "psMatrix", "Create input and output images and vectors");
     v1 = (psVector*)psVectorAlloc(3, PS_TYPE_F64);
+    v1_32 = (psVector*)psVectorAlloc(3, PS_TYPE_F32);
     m1 = (psImage*)psImageAlloc(1, 3, PS_TYPE_F64);
+    m1_32 = (psImage*)psImageAlloc(1,3,PS_TYPE_F32);
     v2 = (psVector*)psVectorAlloc(3, PS_TYPE_F64);
+    v2_32 = (psVector*)psVectorAlloc(3,PS_TYPE_F32);
     m2 = (psImage*)psImageAlloc(1, 3, PS_TYPE_F64);
+    m2_32 = (psImage*)psImageAlloc(1,3,PS_TYPE_F32);
     m3 = (psImage*)psImageAlloc(3, 1, PS_TYPE_F64);
+    m3_32 = (psImage*)psImageAlloc(3,1,PS_TYPE_F32);
     m4 = (psImage*)psImageAlloc(3, 1, PS_TYPE_F64);
+    m4_32 = (psImage*)psImageAlloc(3,1,PS_TYPE_F32);
     badImage = (psImage*)psImageAlloc(2, 2, PS_TYPE_F64);
+    badImage_32 = (psImage*)psImageAlloc(2,2,PS_TYPE_F32);
     m1->data.F64[0][0] = 0.0;
     m1->data.F64[1][0] = 1.0;
     m1->data.F64[2][0] = 2.0;
+    m1_32->data.F32[0][0] = 0.0;
+    m1_32->data.F32[1][0] = 1.0;
+    m1_32->data.F32[2][0] = 2.0;
     v2->data.F64[0] = 0.0;
     v2->data.F64[1] = 1.0;
     v2->data.F64[2] = 2.0;
     v2->n = 3;
+    v2_32->data.F32[0] = 0.0;
+    v2_32->data.F32[1] = 1.0;
+    v2_32->data.F32[2] = 2.0;
+    v2_32->n = 3;
     m4->data.F64[0][0] = 0.0;
     m4->data.F64[0][1] = 1.0;
     m4->data.F64[0][2] = 2.0;
+    m4_32->data.F32[0][0] = 0.0;
+    m4_32->data.F32[0][1] = 1.0;
+    m4_32->data.F32[0][2] = 2.0;
     printFooter(stdout, "psMatrix", "Create input and output images and vectors", true);
-
 
     // Test B - Convert matrix to PS_DIMEN_VECTOR vector
@@ -106,7 +134,19 @@
     CHECK_VECTOR(v1);
     if(v1->type.dimen != PS_DIMEN_VECTOR) {
-        printf("Error: Resulting image is not PS_DIMEN_VECTOR\n");
+        psError(PS_ERR_UNKNOWN,true,"Resulting image is not PS_DIMEN_VECTOR");
+        return 1;
     } else if(v1 != tempVector) {
-        printf("Error: Return pointer not equal to output argument pointer\n");
+        psError(PS_ERR_UNKNOWN,true,"Return pointer not equal to output argument pointer");
+        return 2;
+    }
+    tempVector_32 = v1_32;
+    v1_32 = psMatrixToVector(v1_32, m1_32);
+    CHECK_VECTOR(v1_32);
+    if(v1_32->type.dimen != PS_DIMEN_VECTOR) {
+        psError(PS_ERR_UNKNOWN,true,"Resulting image is not PS_DIMEN_VECTOR");
+        return 1;
+    } else if(v1_32 != tempVector_32) {
+        psError(PS_ERR_UNKNOWN,true,"Return pointer not equal to output argument pointer");
+        return 2;
     }
     printFooter(stdout, "psMatrix", "Convert matrix to PS_DIMEN_VECTOR vector", true);
@@ -116,5 +156,16 @@
     printNegativeTestHeader(stdout,"psMatrix", "Attempt to use null image input argument",
                             "Invalid operation: inImage or its data is NULL.", 0);
+    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error.");
     v1 = psMatrixToVector(v1, NULL);
+    if(v1 != NULL) {
+        psError(PS_ERR_UNKNOWN,true,"Did not return NULL with NULL input");
+        return 3;
+    }
+    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error.");
+    v1_32 = psMatrixToVector(v1_32, NULL);
+    if(v1_32 != NULL) {
+        psError(PS_ERR_UNKNOWN,true,"Did not return NULL with NULL input");
+        return 3;
+    }
     printFooter(stdout, "psMatrix", "Attempt to use null image input argument", true);
 
@@ -123,11 +174,26 @@
     printPositiveTestHeader(stdout, "psMatrix", "Convert matrix to PS_DIMEN_TRANSV vector");
     v3 = psVectorAlloc(3, PS_TYPE_F64);
+    tempVector = v3;
     v3->type.dimen = PS_DIMEN_TRANSV;
     psMatrixToVector(v3, m4);
     CHECK_VECTOR(v3);
     if(v3->type.dimen != PS_DIMEN_TRANSV) {
-        printf("Error: Resulting image is not PS_DIMEN_TRANSV\n");
+        psError(PS_ERR_UNKNOWN,true,"Resulting image is not PS_DIMEN_TRANSV");
+        return 4;
     } else if(v3 != tempVector) {
-        printf("Error: Return pointer not equal to output argument pointer\n");
+        psError(PS_ERR_UNKNOWN,true,"Return pointer not equal to output argument pointer");
+        return 5;
+    }
+    v3_32 = psVectorAlloc(3, PS_TYPE_F32);
+    tempVector_32 = v3_32;
+    v3_32->type.dimen = PS_DIMEN_TRANSV;
+    psMatrixToVector(v3_32, m4_32);
+    CHECK_VECTOR(v3_32);
+    if(v3_32->type.dimen != PS_DIMEN_TRANSV) {
+        psError(PS_ERR_UNKNOWN,true,"Resulting image is not PS_DIMEN_TRANSV");
+        return 6;
+    } else if(v3_32 != tempVector_32) {
+        psError(PS_ERR_UNKNOWN,true,"Return pointer not equal to output argument pointer");
+        return 7;
     }
     printFooter(stdout, "psMatrix", "Convert matrix to PS_DIMEN_TRANSV vector", true);
@@ -137,5 +203,14 @@
     printNegativeTestHeader(stdout,"psMatrix", "Improper image size",
                             "Image does not have dim with 1 col or 1 row: (2 x 2).", 0);
-    psMatrixToVector(v1, badImage);
+    psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message");
+    if(psMatrixToVector(v1, badImage) != NULL ) {
+        psError(PS_ERR_UNKNOWN,true,"Did not return NULL with improper sizes");
+        return 8;
+    }
+    psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message");
+    if(psMatrixToVector(v1_32, badImage_32) != NULL ) {
+        psError(PS_ERR_UNKNOWN,true,"Did not return NULL with improper sizes");
+        return 9;
+    }
     printFooter(stdout, "psMatrix", "Improper image size", true);
 
@@ -147,7 +222,19 @@
     CHECK_MATRIX(m2,truthMatrix);
     if(m2->type.dimen != PS_DIMEN_IMAGE) {
-        printf("Error: Resulting image is not PS_DIMEN_IMAGE\n");
+        psError(PS_ERR_UNKNOWN,true,"Resulting image is not PS_DIMEN_IMAGE");
+        return 10;
     } else if(m2 != tempImage) {
-        printf("Error: Return pointer not equal to output argument pointer\n");
+        psError(PS_ERR_UNKNOWN,true,"Return pointer not equal to output argument pointer");
+        return 11;
+    }
+    tempImage_32 = m2_32;
+    m2_32 = psVectorToMatrix(m2_32, v2_32);
+    CHECK_MATRIX(m2_32,truthMatrix_32);
+    if(m2_32->type.dimen != PS_DIMEN_IMAGE) {
+        psError(PS_ERR_UNKNOWN,true,"Resulting image is not PS_DIMEN_IMAGE");
+        return 10;
+    } else if(m2_32 != tempImage_32) {
+        psError(PS_ERR_UNKNOWN,true,"Return pointer not equal to output argument pointer");
+        return 11;
     }
     printFooter(stdout, "psMatrix", "Convert PS_DIMEN_VECTOR vector to matrix", true);
@@ -157,5 +244,14 @@
     printNegativeTestHeader(stdout,"psMatrix", "Attempt to use null input vector argument",
                             "Invalid operation: inVector or its data is NULL.", 0);
-    psVectorToMatrix(m2, NULL);
+    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message");
+    if(psVectorToMatrix(m2, NULL) != m2) {
+        psError(PS_ERR_UNKNOWN,true,"Did not return output image");
+        return 12;
+    }
+    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message");
+    if(psVectorToMatrix(m2_32, NULL) != m2_32) {
+        psError(PS_ERR_UNKNOWN,true,"Did not return output image");
+        return 13;
+    }
     printFooter(stdout, "psMatrix", "Attempt to use null input vector argument", true);
 
@@ -168,7 +264,20 @@
     CHECK_MATRIX(m3, truthMatrix);
     if(m3->type.dimen != PS_DIMEN_IMAGE) {
-        printf("Error: Resulting image is not PS_DIMEN_IMAGE\n");
+        psError(PS_ERR_UNKNOWN,true,"Resulting image is not PS_DIMEN_IMAGE");
+        return 14;
     } else if(m3 != tempImage) {
-        printf("Error: Return pointer not equal to output argument pointer\n");
+        psError(PS_ERR_UNKNOWN,true,"Return pointer not equal to output argument pointer");
+        return 15;
+    }
+    v2_32->type.dimen = PS_DIMEN_TRANSV;
+    tempImage_32 = m3_32;
+    psVectorToMatrix(m3_32, v2_32);
+    CHECK_MATRIX(m3_32, truthMatrix_32);
+    if(m3_32->type.dimen != PS_DIMEN_IMAGE) {
+        psError(PS_ERR_UNKNOWN,true,"Resulting image is not PS_DIMEN_IMAGE");
+        return 16;
+    } else if(m3_32 != tempImage_32) {
+        psError(PS_ERR_UNKNOWN,true,"Return pointer not equal to output argument pointer");
+        return 17;
     }
     printFooter(stdout, "psMatrix", "Convert PS_DIMEN_TRANSV vector to matrix", true);
@@ -184,5 +293,13 @@
     psFree(m3);
     psFree(m4);
+    psFree(m1_32);
+    psFree(v1_32);
+    psFree(m2_32);
+    psFree(v2_32);
+    psFree(v3_32);
+    psFree(m3_32);
+    psFree(m4_32);
     psFree(badImage);
+    psFree(badImage_32);
     if( psMemCheckLeaks(0, NULL, stdout, false) != 0) {
         psError(PS_ERR_UNKNOWN,true,"Memory leaks detected.");
Index: /trunk/psLib/test/dataManip/verified/tst_psMatrix07.stderr
===================================================================
--- /trunk/psLib/test/dataManip/verified/tst_psMatrix07.stderr	(revision 3290)
+++ /trunk/psLib/test/dataManip/verified/tst_psMatrix07.stderr	(revision 3291)
@@ -1,6 +1,24 @@
+<DATE><TIME>|<HOST>|I|main
+    Following should generate an error.
 <DATE><TIME>|<HOST>|E|psMatrixToVector (FILE:LINENO)
     Unallowable operation: psImage inImage or its data is NULL.
+<DATE><TIME>|<HOST>|I|main
+    Following should generate an error.
+<DATE><TIME>|<HOST>|E|psMatrixToVector (FILE:LINENO)
+    Unallowable operation: psImage inImage or its data is NULL.
+<DATE><TIME>|<HOST>|I|main
+    Following should generate error message
 <DATE><TIME>|<HOST>|E|psMatrixToVector (FILE:LINENO)
     Image does not have dim with 1 col or 1 row: (2 x 2).
+<DATE><TIME>|<HOST>|I|main
+    Following should generate error message
+<DATE><TIME>|<HOST>|E|psMatrixToVector (FILE:LINENO)
+    Image does not have dim with 1 col or 1 row: (2 x 2).
+<DATE><TIME>|<HOST>|I|main
+    Following should generate an error message
 <DATE><TIME>|<HOST>|E|psVectorToMatrix (FILE:LINENO)
     Unallowable operation: psVector inVector or its data is NULL.
+<DATE><TIME>|<HOST>|I|main
+    Following should generate an error message
+<DATE><TIME>|<HOST>|E|psVectorToMatrix (FILE:LINENO)
+    Unallowable operation: psVector inVector or its data is NULL.
