Index: trunk/psLib/test/dataManip/tst_psMatrix07.c
===================================================================
--- trunk/psLib/test/dataManip/tst_psMatrix07.c	(revision 899)
+++ trunk/psLib/test/dataManip/tst_psMatrix07.c	(revision 908)
@@ -5,12 +5,17 @@
  *  This test driver contains the following tests for psMatrix test point 7:
  *     A)  Create input and output images and vectors
- *     B)  Convert matrix to vector
- *     C)  Convert vector to matrix 
- *     D)  Free input and output images and vectors
+ *     B)  Convert matrix to PS_DIMEN_VECTOR vector
+ *     C)  Attempt to use null image input argument
+ *     D)  Convert matrix to PS_DIMEN_TRANSV vector
+ *     E)  Improper image size
+ *     F)  Convert PS_DIMEN_VECTOR vector to matrix
+ *     G)  Attempt to use null input vector argument
+ *     H)  Convert PS_DIMEN_TRANSV vector to matrix
+ *     I)  Free input and output images and vectors
  *
  *  @author  Ross Harman, MHPCC
  *
- *  @version $Revision: 1.2 $  $Name: not supported by cvs2svn $
- *  @date  $Date: 2004-06-02 23:29:39 $
+ *  @version $Revision: 1.3 $  $Name: not supported by cvs2svn $
+ *  @date  $Date: 2004-06-08 01:56:35 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -22,14 +27,14 @@
 
 #define PRINT_MATRIX(IMAGE)                         \
-for(int i=0; i<IMAGE->numRows; i++) {           \
-    for(int j=0; j<IMAGE->numCols; j++) {       \
-        printf("%f ", IMAGE->data.F64[i][j]);   \
-    }                                          \
-    printf("\n");                              \
+for(int i=0; i<IMAGE->numRows; i++) {               \
+    for(int j=0; j<IMAGE->numCols; j++) {           \
+        printf("%f ", IMAGE->data.F64[i][j]);       \
+    }                                               \
+    printf("\n");                                   \
 }
 
 #define PRINT_VECTOR(VECTOR)                        \
-for(int i=0; i<VECTOR->n; i++) {               \
-    printf("%f\n", VECTOR->data.F64[i]);          \
+for(int i=0; i<VECTOR->n; i++) {                    \
+    printf("%f\n", VECTOR->data.F64[i]);            \
 }
 
@@ -39,7 +44,12 @@
 {
     psVector *v1 = NULL;
+    psVector *tempVector = NULL;
+    psImage *tempImage = NULL;
     psImage *m1 = NULL;
     psVector *v2 = NULL;
     psImage *m2 = NULL;
+    psImage *m3 = NULL;
+    psImage *m4 = NULL;
+    psImage *badImage = NULL;
 
 
@@ -50,4 +60,7 @@
     v2 = (psVector*)psVectorAlloc(3, PS_TYPE_F64);
     m2 = (psImage*)psImageAlloc(1, 3, PS_TYPE_F64);
+    m3 = (psImage*)psImageAlloc(3, 1, PS_TYPE_F64);
+    m4 = (psImage*)psImageAlloc(3, 1, PS_TYPE_F64);
+    badImage = (psImage*)psImageAlloc(2, 2, PS_TYPE_F64);
     m1->data.F64[0][0] = 0.0;
     m1->data.F64[1][0] = 1.0;
@@ -57,5 +70,10 @@
     v2->data.F64[2] = 2.0;
     v2->n = 3;
+    m4->data.F64[0][0] = 0.0;
+    m4->data.F64[0][1] = 1.0;
+    m4->data.F64[0][2] = 2.0;
     PRINT_MATRIX(m1);
+    printf("\n");
+    PRINT_MATRIX(m4);
     printf("\n");
     PRINT_VECTOR(v2);
@@ -63,19 +81,79 @@
 
 
-    // Test B - Convert matrix to vector
-    printPositiveTestHeader(stdout, "psMatrix", "Convert matrix to vector");
-    psMatrixToVector(v1, m1);
+    // Test B - Convert matrix to PS_DIMEN_VECTOR vector
+    printPositiveTestHeader(stdout, "psMatrix", "Convert matrix to PS_DIMEN_VECTOR vector");
+    tempVector = v1;
+    v1 = psMatrixToVector(v1, m1);
     PRINT_VECTOR(v1);
-    printFooter(stdout, "psMatrix", "Calculate Eigenvectors", true);
+    if(v1->type.dimen != PS_DIMEN_VECTOR) {
+        printf("Error: Resulting image is not PS_DIMEN_VECTOR\n");
+    } else if(v1 != tempVector) {
+        printf("Error: Return pointer not equal to output argument pointer\n");
+    }
+    printFooter(stdout, "psMatrix", "Convert matrix to PS_DIMEN_VECTOR vector", true);
 
 
-    // Test C - Convert vector to matrix
-    printPositiveTestHeader(stdout, "psMatrix", "Convert vector to matrix");
-    psVectorToMatrix(m2, v2);
-    PRINT_MATRIX(m2);
-    printFooter(stdout, "psMatrix", "Convert vector to matrix", true);
+    // Test C - Attempt to use null image input argument
+    printNegativeTestHeader(stdout,"psMatrix", "Attempt to use null image input argument",
+                            "Invalid operation: inImage or its data is NULL.", 0);
+    v1 = psMatrixToVector(v1, NULL);
+    printFooter(stdout, "psMatrix", "Attempt to use null image input argument", true);
 
 
-    // Test D - Free input and output images
+    // Test D - Convert matrix to PS_DIMEN_TRANSV vector
+    printPositiveTestHeader(stdout, "psMatrix", "Convert matrix to PS_DIMEN_TRANSV vector");
+    v1->type.dimen = PS_DIMEN_TRANSV;
+    psMatrixToVector(v1, m4);
+    PRINT_VECTOR(v1);
+    if(v1->type.dimen != PS_DIMEN_TRANSV) {
+        printf("Error: Resulting image is not PS_DIMEN_TRANSV\n");
+    } else if(v1 != tempVector) {
+        printf("Error: Return pointer not equal to output argument pointer\n");
+    }
+    printFooter(stdout, "psMatrix", "Convert matrix to PS_DIMEN_TRANSV vector", true);
+
+
+    // Test E - Improper image size
+    printNegativeTestHeader(stdout,"psMatrix", "Improper image size",
+                            "Image does not have dim with 1 col or 1 row: (2 x 2).", 0);
+    psMatrixToVector(v1, badImage);
+    printFooter(stdout, "psMatrix", "Improper image size", true);
+
+
+    // Test F - Convert PS_DIMEN_VECTOR vector to matrix
+    printPositiveTestHeader(stdout, "psMatrix", "Convert PS_DIMEN_VECTOR vector to matrix");
+    tempImage = m2;
+    m2 = psVectorToMatrix(m2, v2);
+    PRINT_MATRIX(m2);
+    if(m2->type.dimen != PS_DIMEN_IMAGE) {
+        printf("Error: Resulting image is not PS_DIMEN_IMAGE\n");
+    } else if(m2 != tempImage) {
+        printf("Error: Return pointer not equal to output argument pointer\n");
+    }
+    printFooter(stdout, "psMatrix", "Convert PS_DIMEN_VECTOR vector to matrix", true);
+
+
+    // Test G - Attempt to use null input vector argument
+    printNegativeTestHeader(stdout,"psMatrix", "Attempt to use null input vector argument",
+                            "Invalid operation: inVector or its data is NULL.", 0);
+    psVectorToMatrix(m2, NULL);
+    printFooter(stdout, "psMatrix", "Attempt to use null input vector argument", true);
+
+
+    // Test H - Convert PS_DIMEN_TRANSV vector to matrix
+    printPositiveTestHeader(stdout, "psMatrix", "Convert PS_DIMEN_TRANSV vector to matrix");
+    v2->type.dimen = PS_DIMEN_TRANSV;
+    tempImage = m3;
+    psVectorToMatrix(m3, v2);
+    PRINT_MATRIX(m3);
+    if(m3->type.dimen != PS_DIMEN_IMAGE) {
+        printf("Error: Resulting image is not PS_DIMEN_IMAGE\n");
+    } else if(m3 != tempImage) {
+        printf("Error: Return pointer not equal to output argument pointer\n");
+    }
+    printFooter(stdout, "psMatrix", "Convert PS_DIMEN_TRANSV vector to matrix", true);
+
+
+    // Test I - Free input and output images
     printPositiveTestHeader(stdout, "psMatrix", "Free input and output images and vectors");
     psImageFree(m1);
@@ -83,4 +161,7 @@
     psImageFree(m2);
     psVectorFree(v2);
+    psImageFree(m3);
+    psImageFree(m4);
+    psImageFree(badImage);
     psMemCheckLeaks(0, NULL, stdout);
     int nBad = psMemCheckCorruption(0);
Index: trunk/psLib/test/dataManip/verified/tst_psMatrix07.stderr
===================================================================
--- trunk/psLib/test/dataManip/verified/tst_psMatrix07.stderr	(revision 908)
+++ trunk/psLib/test/dataManip/verified/tst_psMatrix07.stderr	(revision 908)
@@ -0,0 +1,3 @@
+ <DATE> <TIME> <HOST> |E|psMatrixToVector|Invalid operation: inImage or its data is NULL.
+ <DATE> <TIME> <HOST> |E|psMatrixToVector|Image does not have dim with 1 col or 1 row: (2 x 2).
+ <DATE> <TIME> <HOST> |E|psVectorToMatrix|Invalid operation: inVector or its data is NULL.
Index: trunk/psLib/test/dataManip/verified/tst_psMatrix07.stdout
===================================================================
--- trunk/psLib/test/dataManip/verified/tst_psMatrix07.stdout	(revision 899)
+++ trunk/psLib/test/dataManip/verified/tst_psMatrix07.stdout	(revision 908)
@@ -9,4 +9,6 @@
 2.000000 
 
+0.000000 1.000000 2.000000 
+
 0.000000
 1.000000
@@ -17,5 +19,5 @@
 /----------------------------- TESTPOINT ------------------------------------------\
 |             TestFile: tst_psMatrix07.c                                           |
-|            TestPoint: psMatrix{Convert matrix to vector}                         |
+|            TestPoint: psMatrix{Convert matrix to PS_DIMEN_VECTOR vector}         |
 |             TestType: Positive                                                   |
 \----------------------------------------------------------------------------------/
@@ -25,9 +27,43 @@
 2.000000
 
----> TESTPOINT PASSED (psMatrix{Calculate Eigenvectors} | tst_psMatrix07.c)
+---> TESTPOINT PASSED (psMatrix{Convert matrix to PS_DIMEN_VECTOR vector} | tst_psMatrix07.c)
 
 /----------------------------- TESTPOINT ------------------------------------------\
 |             TestFile: tst_psMatrix07.c                                           |
-|            TestPoint: psMatrix{Convert vector to matrix}                         |
+|            TestPoint: psMatrix{Attempt to use null image input argument}         |
+|             TestType: Negative                                                   |
+|    ExpectedErrorText: Invalid operation: inImage or its data is NULL.            |
+|  ExpectedStatusValue: 0                                                          |
+\----------------------------------------------------------------------------------/
+
+
+---> TESTPOINT PASSED (psMatrix{Attempt to use null image input argument} | tst_psMatrix07.c)
+
+/----------------------------- TESTPOINT ------------------------------------------\
+|             TestFile: tst_psMatrix07.c                                           |
+|            TestPoint: psMatrix{Convert matrix to PS_DIMEN_TRANSV vector}         |
+|             TestType: Positive                                                   |
+\----------------------------------------------------------------------------------/
+
+0.000000
+1.000000
+2.000000
+
+---> TESTPOINT PASSED (psMatrix{Convert matrix to PS_DIMEN_TRANSV vector} | tst_psMatrix07.c)
+
+/----------------------------- TESTPOINT ------------------------------------------\
+|             TestFile: tst_psMatrix07.c                                           |
+|            TestPoint: psMatrix{Improper image size}                              |
+|             TestType: Negative                                                   |
+|    ExpectedErrorText: Image does not have dim with 1 col or 1 row: (2 x 2).      |
+|  ExpectedStatusValue: 0                                                          |
+\----------------------------------------------------------------------------------/
+
+
+---> TESTPOINT PASSED (psMatrix{Improper image size} | tst_psMatrix07.c)
+
+/----------------------------- TESTPOINT ------------------------------------------\
+|             TestFile: tst_psMatrix07.c                                           |
+|            TestPoint: psMatrix{Convert PS_DIMEN_VECTOR vector to matrix}         |
 |             TestType: Positive                                                   |
 \----------------------------------------------------------------------------------/
@@ -37,5 +73,26 @@
 2.000000 
 
----> TESTPOINT PASSED (psMatrix{Convert vector to matrix} | tst_psMatrix07.c)
+---> TESTPOINT PASSED (psMatrix{Convert PS_DIMEN_VECTOR vector to matrix} | tst_psMatrix07.c)
+
+/----------------------------- TESTPOINT ------------------------------------------\
+|             TestFile: tst_psMatrix07.c                                           |
+|            TestPoint: psMatrix{Attempt to use null input vector argument}        |
+|             TestType: Negative                                                   |
+|    ExpectedErrorText: Invalid operation: inVector or its data is NULL.           |
+|  ExpectedStatusValue: 0                                                          |
+\----------------------------------------------------------------------------------/
+
+
+---> TESTPOINT PASSED (psMatrix{Attempt to use null input vector argument} | tst_psMatrix07.c)
+
+/----------------------------- TESTPOINT ------------------------------------------\
+|             TestFile: tst_psMatrix07.c                                           |
+|            TestPoint: psMatrix{Convert PS_DIMEN_TRANSV vector to matrix}         |
+|             TestType: Positive                                                   |
+\----------------------------------------------------------------------------------/
+
+0.000000 1.000000 2.000000 
+
+---> TESTPOINT PASSED (psMatrix{Convert PS_DIMEN_TRANSV vector to matrix} | tst_psMatrix07.c)
 
 /----------------------------- TESTPOINT ------------------------------------------\
