Index: trunk/psLib/test/dataManip/tst_psMatrix04.c
===================================================================
--- trunk/psLib/test/dataManip/tst_psMatrix04.c	(revision 798)
+++ trunk/psLib/test/dataManip/tst_psMatrix04.c	(revision 897)
@@ -8,9 +8,11 @@
  *     C)  Calculate determinant only
  *     D)  Free input and output images
- *
+ *     E)  Attempt to use null input image argument
+ *     F)  Attempt to use null input float argument
+ *  
  *  @author  Ross Harman, MHPCC
  *
- *  @version $Revision: 1.1 $  $Name: not supported by cvs2svn $
- *  @date  $Date: 2004-05-28 02:52:23 $
+ *  @version $Revision: 1.2 $  $Name: not supported by cvs2svn $
+ *  @date  $Date: 2004-06-07 20:25:03 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -22,9 +24,9 @@
 
 #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");                              \
+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");                                   \
 }
 
@@ -34,6 +36,8 @@
 {
     float det = 0.0f;
+    float *det2 = NULL;
     psImage *outImage = NULL;
     psImage *inImage = NULL;
+    psImage *tempImage = NULL;
 
 
@@ -57,7 +61,13 @@
     // Test B - Invert matrix and calculate determinant
     printPositiveTestHeader(stdout, "psMatrix", "Invert matrix and calculate determinant");
-    psMatrixInvert(outImage, inImage, &det);
+    tempImage = outImage;
+    outImage = psMatrixInvert(outImage, inImage, &det);
     PRINT_MATRIX(outImage);
     printf("\ndet = %f\n", det);
+    if(outImage->type.dimen != PS_DIMEN_IMAGE) {
+        printf("Error: Resulting image is not PS_DIMEN_IMAGE\n");
+    } else if(outImage != tempImage) {
+        printf("Error: Return pointer not equal to output argument pointer\n");
+    }
     printFooter(stdout, "psMatrix", "Invert matrix and calculate determinant", true);
 
@@ -65,7 +75,6 @@
     // Test C - Calculate determinant only
     printPositiveTestHeader(stdout, "psMatrix", "Calculate determinant only");
-    det = 0.0f;
-    det = psMatrixDeterminant(inImage);
-    printf("det = %f\n", det);
+    det2 = psMatrixDeterminant(inImage);
+    printf("det = %f\n", *det2);
     printFooter(stdout, "psMatrix", "Calculate determinant only", true);
 
@@ -75,4 +84,5 @@
     psImageFree(outImage);
     psImageFree(inImage);
+    psFree(det2);
     psMemCheckLeaks(0, NULL, stdout);
     int nBad = psMemCheckCorruption(0);
@@ -82,4 +92,20 @@
     printFooter(stdout, "psMatrix" ,"Free input and output images", true);
 
+
+    // Test E - Attempt to use null input image argument
+    printNegativeTestHeader(stdout,"psMatrix", "Attempt to use null input image argument",
+                            "Invalid operation: inImage or its data is NULL.", 0);
+    psImage *badOutImage = (psImage*)psImageAlloc(3, 3, PS_TYPE_F64);
+    psMatrixInvert(badOutImage, NULL, &det);
+    printFooter(stdout, "psMatrix", "Attempt to use null input image argument", true);
+
+
+    // Test F - Attempt to use null input float argument
+    printNegativeTestHeader(stdout,"psMatrix", "Attempt to use null input float argument",
+                            "Invalid operation: determinant argument is NULL.", 0);
+    psImage *badInImage = (psImage*)psImageAlloc(3, 3, PS_TYPE_F64);
+    psMatrixInvert(badOutImage, badInImage, NULL);
+    printFooter(stdout, "psMatrix", "Attempt to use null input float argument", true);
+
     return 0;
 }
