Index: /trunk/psLib/test/dataManip/tst_psMatrix03.c
===================================================================
--- /trunk/psLib/test/dataManip/tst_psMatrix03.c	(revision 871)
+++ /trunk/psLib/test/dataManip/tst_psMatrix03.c	(revision 872)
@@ -8,9 +8,12 @@
  *     C)  Determine solution to matrix equation  
  *     D)  Free input and output images and vectors
- *
+ *     E)  Attempt to use null image input argument
+ *     F)  Attempt to use null input vector argument
+ *     G)  ttempt to use null LU image argument
+ * 
  *  @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-04 23:42:18 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -21,15 +24,15 @@
 #include "psTest.h"
 
-#define PRINT_MATRIX(IMAGE)                         \
+#define PRINT_MATRIX(IMAGE)                     \
 for(int i=IMAGE->numRows-1; i>-1; i--) {        \
     for(int j=0; j<IMAGE->numCols; j++) {       \
         printf("%f ", IMAGE->data.F64[i][j]);   \
-    }                                          \
-    printf("\n");                              \
+    }                                           \
+    printf("\n");                               \
 }
-
-#define PRINT_VECTOR(VECTOR)                        \
-for(int i=0; i<VECTOR->n; i++) {               \
-    printf("%f\n", VECTOR->data.F64[i]);          \
+\
+#define PRINT_VECTOR(VECTOR)                    \
+for(int i=0; i<VECTOR->n; i++) {                \
+    printf("%f\n", VECTOR->data.F64[i]);        \
 }
 
@@ -40,4 +43,6 @@
     psImage *luImage = NULL;
     psImage *inImage = NULL;
+    psImage *tempImage = NULL;
+    psVector *tempVector = NULL;
     psVector *perm = NULL;
     psVector *outVector = NULL;
@@ -73,6 +78,12 @@
     // Test B - Calculate LU matrix
     printPositiveTestHeader(stdout, "psMatrix", "Calculate LU matrix");
-    psMatrixLUD(luImage, perm, inImage);
+    tempImage = luImage;
+    luImage = psMatrixLUD(luImage, perm, inImage);
     PRINT_MATRIX(luImage);
+    if(luImage->type.type != PS_DIMEN_IMAGE) {
+        printf("Error: Resulting image is not PS_DIMEN_IMAGE\n");
+    } else if(luImage != tempImage) {
+        printf("Error: Return pointer not equal to output argument pointer\n");
+    }
     printFooter(stdout, "psMatrix", "Calculate LU matrix", true);
 
@@ -80,6 +91,12 @@
     // Test C - Determine solution to matrix equation
     printPositiveTestHeader(stdout, "psMatrix", "Determine solution to matrix equation");
-    psMatrixLUSolve(outVector, luImage, inVector, perm);
+    tempVector = outVector;
+    outVector = psMatrixLUSolve(outVector, luImage, inVector, perm);
     PRINT_VECTOR(outVector);
+    if(outVector->type.type != PS_DIMEN_VECTOR) {
+        printf("Error: Resulting image is not PS_DIMEN_VECTOR\n");
+    } else if(outVector != tempVector) {
+        printf("Error: Return pointer not equal to output argument pointer\n");
+    }
     printFooter(stdout, "psMatrix", "Determine solution to matrix equation", true);
 
@@ -99,4 +116,28 @@
     printFooter(stdout, "psMatrix" ,"Free input and output images and vectors", true);
 
+
+    // Test E - 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);
+    psImage *imageTest = (psImage*)psImageAlloc(3, 3, PS_TYPE_F64);
+    psMatrixLUD(imageTest, NULL, NULL);
+    printFooter(stdout, "psMatrix", "Attempt to use null image input argument", true);
+
+
+    // Test F - 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);
+    psVector *vectorBad = NULL;
+    psVector *vectorBadOut = (psVector*)psVectorAlloc(3, PS_TYPE_F64);
+    psVector *permBad = (psVector*)psVectorAlloc(3, PS_TYPE_F64);
+    psMatrixLUSolve(vectorBadOut, imageTest, vectorBad, permBad);
+    printFooter(stdout, "psMatrix", "Attempt to use null input vector argument", true);
+
+
+    // Test G - Attempt to use null LU image argument
+    printNegativeTestHeader(stdout,"psMatrix", "Attempt to use null LU image argument",
+                            "Invalid operation: inImage or its data is NULL.", 0);
+    psMatrixLUSolve(vectorBadOut, NULL, vectorBad, permBad);
+    printFooter(stdout, "psMatrix", "Attempt to use null LU image argument", true);
     return 0;
 }
Index: /trunk/psLib/test/dataManip/verified/tst_psMatrix03.stderr
===================================================================
--- /trunk/psLib/test/dataManip/verified/tst_psMatrix03.stderr	(revision 872)
+++ /trunk/psLib/test/dataManip/verified/tst_psMatrix03.stderr	(revision 872)
@@ -0,0 +1,3 @@
+ <DATE> <TIME> <HOST> |E|psMatrixLUD    |Invalid operation: inImage or its data is NULL.
+ <DATE> <TIME> <HOST> |E|psMatrixLUSolve|Invalid operation: inVector or its data is NULL.
+ <DATE> <TIME> <HOST> |E|psMatrixLUSolve|Invalid operation: inImage or its data is NULL.
Index: /trunk/psLib/test/dataManip/verified/tst_psMatrix03.stdout
===================================================================
--- /trunk/psLib/test/dataManip/verified/tst_psMatrix03.stdout	(revision 871)
+++ /trunk/psLib/test/dataManip/verified/tst_psMatrix03.stdout	(revision 872)
@@ -24,4 +24,5 @@
 0.750000 -2.750000 -6.500000 
 4.000000 5.000000 6.000000 
+Error: Resulting image is not PS_DIMEN_IMAGE
 
 ---> TESTPOINT PASSED (psMatrix{Calculate LU matrix} | tst_psMatrix03.c)
@@ -36,4 +37,5 @@
 -2.000000
 3.000000
+Error: Resulting image is not PS_DIMEN_VECTOR
 
 ---> TESTPOINT PASSED (psMatrix{Determine solution to matrix equation} | tst_psMatrix03.c)
@@ -48,2 +50,35 @@
 ---> TESTPOINT PASSED (psMatrix{Free input and output images and vectors} | tst_psMatrix03.c)
 
+/----------------------------- TESTPOINT ------------------------------------------\
+|             TestFile: tst_psMatrix03.c                                           |
+|            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_psMatrix03.c)
+
+/----------------------------- TESTPOINT ------------------------------------------\
+|             TestFile: tst_psMatrix03.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_psMatrix03.c)
+
+/----------------------------- TESTPOINT ------------------------------------------\
+|             TestFile: tst_psMatrix03.c                                           |
+|            TestPoint: psMatrix{Attempt to use null LU image argument}            |
+|             TestType: Negative                                                   |
+|    ExpectedErrorText: Invalid operation: inImage or its data is NULL.            |
+|  ExpectedStatusValue: 0                                                          |
+\----------------------------------------------------------------------------------/
+
+
+---> TESTPOINT PASSED (psMatrix{Attempt to use null LU image argument} | tst_psMatrix03.c)
+
