Index: trunk/psLib/test/dataManip/tst_psMatrix02.c
===================================================================
--- trunk/psLib/test/dataManip/tst_psMatrix02.c	(revision 3264)
+++ 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);
