Index: trunk/psLib/test/dataManip/tst_psMatrix02.c
===================================================================
--- trunk/psLib/test/dataManip/tst_psMatrix02.c	(revision 3299)
+++ trunk/psLib/test/dataManip/tst_psMatrix02.c	(revision 3313)
@@ -12,6 +12,6 @@
  *  @author  Ross Harman, MHPCC
  *
- *  @version $Revision: 1.5 $  $Name: not supported by cvs2svn $
- *  @date  $Date: 2005-02-17 19:26:25 $
+ *  @version $Revision: 1.6 $  $Name: not supported by cvs2svn $
+ *  @date  $Date: 2005-02-24 00:19:51 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -32,30 +32,66 @@
 
     // Test A - Input pointer same as output pointer
-    printNegativeTestHeader(stdout,"psMatrix", "Input pointer same as output pointer",
-                            "Invalid operation: Pointer to inImage is same as outImage.", 0);
-    psMatrixTranspose(inImage, inImage);
+    printPositiveTestHeader(stdout,"psMatrix", "Input pointer same as output pointer");
+    psMemIncrRefCounter(inImage);
+    if (psMatrixTranspose(inImage, inImage) != NULL) {
+        psError(PS_ERR_UNKNOWN, true,
+                "inImage = outImage didn't results in NULL return");
+        return 1;
+    }
+    if (psMemGetRefCounter(inImage) != 1) {
+        psError(PS_ERR_UNKNOWN, true,
+                "the output image was not freed on an error.");
+        return 2;
+    }
     printFooter(stdout, "psMatrix", "Input pointer same as output pointer", true);
 
     // Test B - Null input psImage
-    printNegativeTestHeader(stdout,"psMatrix", "Null input psImage",
-                            "Invalid operation: inImage or its data is NULL.", 0);
-    psMatrixTranspose(outImage, nullImage);
+    printPositiveTestHeader(stdout,"psMatrix", "Null input psImage");
+    psMemIncrRefCounter(outImage);
+    if (psMatrixTranspose(outImage, nullImage) != NULL) {
+        psError(PS_ERR_UNKNOWN, true,
+                "inImage = outImage didn't results in NULL return");
+        return 3;
+    }
+    if (psMemGetRefCounter(outImage) != 1) {
+        psError(PS_ERR_UNKNOWN, true,
+                "the output image was not freed on an error.");
+        return 4;
+    }
     printFooter(stdout, "psMatrix", "Null input psImage", true);
 
     // Test C - Incorrect type for input pointer
-    printNegativeTestHeader(stdout,"psMatrix", "Incorrect type for input pointer",
-                            "|Invalid operation: inImage not PS_TYPE_F64.", 0);
-    psMatrixTranspose(outImage, badImage1);
+    printPositiveTestHeader(stdout,"psMatrix", "Incorrect type for input pointer");
+    psMemIncrRefCounter(outImage);
+    if (psMatrixTranspose(outImage, badImage1) != NULL) {
+        psError(PS_ERR_UNKNOWN, true,
+                "inImage = outImage didn't results in NULL return");
+        return 5;
+    }
+    if (psMemGetRefCounter(outImage) != 1) {
+        psError(PS_ERR_UNKNOWN, true,
+                "the output image was not freed on an error.");
+        return 6;
+    }
     printFooter(stdout, "psMatrix", "Incorrect type for input pointer", true);
 
     // Test D - Incorrect type for output pointer
-    printNegativeTestHeader(stdout,"psMatrix", "Incorrect type for output pointer",
-                            "Invalid operation: outImage not PS_TYPE_F64.", 0);
-    psMatrixTranspose(badImage1, inImage);
+    printPositiveTestHeader(stdout,"psMatrix", "Incorrect type for output pointer");
+    badImage1 = psMatrixTranspose(badImage1, inImage);
+    if (badImage1 == NULL) {
+        psError(PS_ERR_UNKNOWN, true,
+                "inImage = outImage didn't results in NULL return");
+        return 7;
+    }
+    // check that the type was changed.
+    if (badImage1->type.type != PS_TYPE_F64) {
+        psError(PS_ERR_UNKNOWN, true,
+                "the output image was not freed on an error.");
+        return 8;
+    }
     printFooter(stdout, "psMatrix", "Incorrect type for output pointer", true);
 
     // Test E - Matrix not square for output pointer
-    printNegativeTestHeader(stdout,"psMatrix", "Matrix not square for output pointer",
-                            "Invalid operation: outImage not square array.", 0);
+    printPositiveTestHeader(stdout,"psMatrix", "Matrix not square for output pointer");
     psMatrixTranspose(badImage2, inImage);
     printFooter(stdout, "psMatrix", "Matrix not square for output pointer", true);
Index: trunk/psLib/test/dataManip/tst_psMatrix03.c
===================================================================
--- trunk/psLib/test/dataManip/tst_psMatrix03.c	(revision 3299)
+++ trunk/psLib/test/dataManip/tst_psMatrix03.c	(revision 3313)
@@ -14,6 +14,6 @@
  *  @author  Ross Harman, MHPCC
  *
- *  @version $Revision: 1.14 $  $Name: not supported by cvs2svn $
- *  @date  $Date: 2005-02-17 19:26:25 $
+ *  @version $Revision: 1.15 $  $Name: not supported by cvs2svn $
+ *  @date  $Date: 2005-02-24 00:19:51 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -148,5 +148,4 @@
     printFooter(stdout, "psMatrix", "Calculate LU matrix", true);
 
-
     // Test C - Determine solution to matrix equation
     printPositiveTestHeader(stdout, "psMatrix", "Determine solution to matrix equation");
@@ -208,4 +207,5 @@
     psVector *vectorBadOut = (psVector*)psVectorAlloc(3, PS_TYPE_F64);
     psVector *permBad = (psVector*)psVectorAlloc(3, PS_TYPE_F64);
+    imageTest = (psImage*)psImageAlloc(3, 3, PS_TYPE_F64);
     psMatrixLUSolve(vectorBadOut, imageTest, vectorBad, permBad);
     printFooter(stdout, "psMatrix", "Attempt to use null input vector argument", true);
@@ -215,7 +215,20 @@
     printNegativeTestHeader(stdout,"psMatrix", "Attempt to use null LU image argument",
                             "Invalid operation: inImage or its data is NULL.", 0);
+    vectorBadOut = (psVector*)psVectorAlloc(3, PS_TYPE_F64);
     psMatrixLUSolve(vectorBadOut, NULL, vectorBad, permBad);
     printFooter(stdout, "psMatrix", "Attempt to use null LU image argument", true);
 
+    psFree(permBad);
+    psFree(imageTest);
+
+    if( psMemCheckLeaks(0, NULL, stdout, false) ) {
+        psError(PS_ERR_UNKNOWN,true,"Memory leaks detected");
+        return 10;
+    }
+    nBad = psMemCheckCorruption(0);
+    if(nBad) {
+        printf("ERROR: Found %d bad memory blocks\n", nBad);
+    }
+
     return 0;
 }
Index: trunk/psLib/test/dataManip/tst_psMatrix07.c
===================================================================
--- trunk/psLib/test/dataManip/tst_psMatrix07.c	(revision 3299)
+++ trunk/psLib/test/dataManip/tst_psMatrix07.c	(revision 3313)
@@ -16,6 +16,6 @@
  *  @author  Ross Harman, MHPCC
  *
- *  @version $Revision: 1.10 $  $Name: not supported by cvs2svn $
- *  @date  $Date: 2005-02-19 00:43:32 $
+ *  @version $Revision: 1.11 $  $Name: not supported by cvs2svn $
+ *  @date  $Date: 2005-02-24 00:19:51 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -245,10 +245,10 @@
                             "Invalid operation: inVector or its data is NULL.", 0);
     psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message");
-    if(psVectorToMatrix(m2, NULL) != m2) {
+    if(psVectorToMatrix(m2, NULL) != NULL) {
         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) {
+    if(psVectorToMatrix(m2_32, NULL) != NULL) {
         psError(PS_ERR_UNKNOWN,true,"Did not return output image");
         return 13;
@@ -288,5 +288,4 @@
     psFree(m1);
     psFree(v1);
-    psFree(m2);
     psFree(v2);
     psFree(v3);
@@ -295,5 +294,4 @@
     psFree(m1_32);
     psFree(v1_32);
-    psFree(m2_32);
     psFree(v2_32);
     psFree(v3_32);
Index: trunk/psLib/test/dataManip/verified/tst_psMatrix02.stdout
===================================================================
--- trunk/psLib/test/dataManip/verified/tst_psMatrix02.stdout	(revision 3299)
+++ trunk/psLib/test/dataManip/verified/tst_psMatrix02.stdout	(revision 3313)
@@ -2,7 +2,5 @@
 *             TestFile: tst_psMatrix02.c                                           *
 *            TestPoint: psMatrix{Input pointer same as output pointer}             *
-*             TestType: Negative                                                   *
-*    ExpectedErrorText: Invalid operation: Pointer to inImage is same as outImage. *
-*  ExpectedStatusValue: 0                                                          *
+*             TestType: Positive                                                   *
 \**********************************************************************************/
 
@@ -13,7 +11,5 @@
 *             TestFile: tst_psMatrix02.c                                           *
 *            TestPoint: psMatrix{Null input psImage}                               *
-*             TestType: Negative                                                   *
-*    ExpectedErrorText: Invalid operation: inImage or its data is NULL.            *
-*  ExpectedStatusValue: 0                                                          *
+*             TestType: Positive                                                   *
 \**********************************************************************************/
 
@@ -24,7 +20,5 @@
 *             TestFile: tst_psMatrix02.c                                           *
 *            TestPoint: psMatrix{Incorrect type for input pointer}                 *
-*             TestType: Negative                                                   *
-*    ExpectedErrorText: |Invalid operation: inImage not PS_TYPE_F64.               *
-*  ExpectedStatusValue: 0                                                          *
+*             TestType: Positive                                                   *
 \**********************************************************************************/
 
@@ -35,7 +29,5 @@
 *             TestFile: tst_psMatrix02.c                                           *
 *            TestPoint: psMatrix{Incorrect type for output pointer}                *
-*             TestType: Negative                                                   *
-*    ExpectedErrorText: Invalid operation: outImage not PS_TYPE_F64.               *
-*  ExpectedStatusValue: 0                                                          *
+*             TestType: Positive                                                   *
 \**********************************************************************************/
 
@@ -46,7 +38,5 @@
 *             TestFile: tst_psMatrix02.c                                           *
 *            TestPoint: psMatrix{Matrix not square for output pointer}             *
-*             TestType: Negative                                                   *
-*    ExpectedErrorText: Invalid operation: outImage not square array.              *
-*  ExpectedStatusValue: 0                                                          *
+*             TestType: Positive                                                   *
 \**********************************************************************************/
 
