Index: /trunk/psLib/test/dataIO/tst_psFits.c
===================================================================
--- /trunk/psLib/test/dataIO/tst_psFits.c	(revision 2967)
+++ /trunk/psLib/test/dataIO/tst_psFits.c	(revision 2968)
@@ -6,6 +6,6 @@
 *  @author Robert DeSonia, MHPCC
 *
-*  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2005-01-13 02:08:30 $
+*  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2005-01-13 02:20:44 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -18,5 +18,5 @@
 #include <string.h>
 
-static bool makeMulti(void);
+static bool makeMulti(void);  // implicitly tests psFitsSetExtName
 const char* multiFilename = "multi.fits";
 
@@ -184,5 +184,5 @@
     // check to see if given a bogus extension name, it errors.
     psLogMsg(__func__,PS_LOG_INFO, "Following should be an error.");
-    if (psFitsMoveExtName(fits, "bogus") ) {
+    if (psFitsMoveExtName(fits, "bogus") || psErrorGetStackSize() != 1) {
         psError(PS_ERR_UNKNOWN, false,
                 "Moving to non-existant HDU didn't fail.");
@@ -192,5 +192,5 @@
     // check to see if given a NULL psFits, it errors.
     psLogMsg(__func__,PS_LOG_INFO, "Following should be an error.");
-    if (psFitsMoveExtName(NULL, "bogus") ) {
+    if (psFitsMoveExtName(NULL, "bogus") || psErrorGetStackSize() != 1) {
         psError(PS_ERR_UNKNOWN, false,
                 "Operation of NULL psFits didn't fail.");
@@ -200,5 +200,5 @@
     // check to see if given a NULL extname, it errors.
     psLogMsg(__func__,PS_LOG_INFO, "Following should be an error.");
-    if (psFitsMoveExtName(fits, NULL) ) {
+    if (psFitsMoveExtName(fits, NULL) || psErrorGetStackSize() != 1) {
         psError(PS_ERR_UNKNOWN, false,
                 "Operation of NULL extname didn't fail.");
@@ -222,5 +222,15 @@
     int numHDUs = psFitsGetSize(fits);
 
-    if (numHDUs < 2) {
+    // as a side test, let's make sure psFitsGetSize can handle NULL.
+    psLogMsg(__func__,PS_LOG_INFO,
+             "Following should be an error.");
+    psErrorClear();
+    if (psFitsGetSize(NULL) != 0 || psErrorGetStackSize() != 1) {
+        psError(PS_ERR_UNKNOWN,true,
+                "The 'multi' FITS file does not have multiple HDUs.");
+        return 2;
+    }
+
+    if (numHDUs != 8) {
         psError(PS_ERR_UNKNOWN,true,
                 "The 'multi' FITS file does not have multiple HDUs.");
@@ -347,5 +357,6 @@
     // check to see if given a negative extension number, it errors.
     psLogMsg(__func__,PS_LOG_INFO, "Following should be an error.");
-    if (psFitsMoveExtNum(fits, -1, false) ) {
+    psErrorClear();
+    if (psFitsMoveExtNum(fits, -1, false) || psErrorGetStackSize() != 1) {
         psError(PS_ERR_UNKNOWN, false,
                 "Moving to negative HDU didn't fail.");
@@ -356,5 +367,6 @@
     psFitsMoveExtNum(fits,0,false);
     psLogMsg(__func__,PS_LOG_INFO, "Following should be an error.");
-    if (psFitsMoveExtNum(fits, -1, true) ) {
+    psErrorClear();
+    if (psFitsMoveExtNum(fits, -1, true) || psErrorGetStackSize() != 1) {
         psError(PS_ERR_UNKNOWN, false,
                 "Moving to negative HDU didn't fail.");
@@ -365,5 +377,6 @@
     // check to see if given a extension greater than the total #HDUs, it errors.
     psLogMsg(__func__,PS_LOG_INFO, "Following should be an error.");
-    if (psFitsMoveExtNum(fits, numHDUs, false) ) {
+    psErrorClear();
+    if (psFitsMoveExtNum(fits, numHDUs, false) || psErrorGetStackSize() != 1) {
         psError(PS_ERR_UNKNOWN, false,
                 "Moving to a HDU beyond the file's contents didn't fail.");
@@ -374,5 +387,6 @@
     psFitsMoveExtNum(fits,numHDUs-1,false);
     psLogMsg(__func__,PS_LOG_INFO, "Following should be an error.");
-    if (psFitsMoveExtNum(fits, 1, true) ) {
+    psErrorClear();
+    if (psFitsMoveExtNum(fits, 1, true) || psErrorGetStackSize() != 1) {
         psError(PS_ERR_UNKNOWN, false,
                 "Moving to negative HDU didn't fail.");
@@ -382,5 +396,6 @@
     // check to see if given a NULL psFits, it errors.
     psLogMsg(__func__,PS_LOG_INFO, "Following should be an error.");
-    if (psFitsMoveExtNum(NULL, 0, false) ) {
+    psErrorClear();
+    if (psFitsMoveExtNum(NULL, 0, false) || psErrorGetStackSize() != 1) {
         psError(PS_ERR_UNKNOWN, false,
                 "Operation of NULL psFits didn't fail.");
Index: /trunk/psLib/test/fileUtils/tst_psFits.c
===================================================================
--- /trunk/psLib/test/fileUtils/tst_psFits.c	(revision 2967)
+++ /trunk/psLib/test/fileUtils/tst_psFits.c	(revision 2968)
@@ -6,6 +6,6 @@
 *  @author Robert DeSonia, MHPCC
 *
-*  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2005-01-13 02:08:30 $
+*  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2005-01-13 02:20:44 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -18,5 +18,5 @@
 #include <string.h>
 
-static bool makeMulti(void);
+static bool makeMulti(void);  // implicitly tests psFitsSetExtName
 const char* multiFilename = "multi.fits";
 
@@ -184,5 +184,5 @@
     // check to see if given a bogus extension name, it errors.
     psLogMsg(__func__,PS_LOG_INFO, "Following should be an error.");
-    if (psFitsMoveExtName(fits, "bogus") ) {
+    if (psFitsMoveExtName(fits, "bogus") || psErrorGetStackSize() != 1) {
         psError(PS_ERR_UNKNOWN, false,
                 "Moving to non-existant HDU didn't fail.");
@@ -192,5 +192,5 @@
     // check to see if given a NULL psFits, it errors.
     psLogMsg(__func__,PS_LOG_INFO, "Following should be an error.");
-    if (psFitsMoveExtName(NULL, "bogus") ) {
+    if (psFitsMoveExtName(NULL, "bogus") || psErrorGetStackSize() != 1) {
         psError(PS_ERR_UNKNOWN, false,
                 "Operation of NULL psFits didn't fail.");
@@ -200,5 +200,5 @@
     // check to see if given a NULL extname, it errors.
     psLogMsg(__func__,PS_LOG_INFO, "Following should be an error.");
-    if (psFitsMoveExtName(fits, NULL) ) {
+    if (psFitsMoveExtName(fits, NULL) || psErrorGetStackSize() != 1) {
         psError(PS_ERR_UNKNOWN, false,
                 "Operation of NULL extname didn't fail.");
@@ -222,5 +222,15 @@
     int numHDUs = psFitsGetSize(fits);
 
-    if (numHDUs < 2) {
+    // as a side test, let's make sure psFitsGetSize can handle NULL.
+    psLogMsg(__func__,PS_LOG_INFO,
+             "Following should be an error.");
+    psErrorClear();
+    if (psFitsGetSize(NULL) != 0 || psErrorGetStackSize() != 1) {
+        psError(PS_ERR_UNKNOWN,true,
+                "The 'multi' FITS file does not have multiple HDUs.");
+        return 2;
+    }
+
+    if (numHDUs != 8) {
         psError(PS_ERR_UNKNOWN,true,
                 "The 'multi' FITS file does not have multiple HDUs.");
@@ -347,5 +357,6 @@
     // check to see if given a negative extension number, it errors.
     psLogMsg(__func__,PS_LOG_INFO, "Following should be an error.");
-    if (psFitsMoveExtNum(fits, -1, false) ) {
+    psErrorClear();
+    if (psFitsMoveExtNum(fits, -1, false) || psErrorGetStackSize() != 1) {
         psError(PS_ERR_UNKNOWN, false,
                 "Moving to negative HDU didn't fail.");
@@ -356,5 +367,6 @@
     psFitsMoveExtNum(fits,0,false);
     psLogMsg(__func__,PS_LOG_INFO, "Following should be an error.");
-    if (psFitsMoveExtNum(fits, -1, true) ) {
+    psErrorClear();
+    if (psFitsMoveExtNum(fits, -1, true) || psErrorGetStackSize() != 1) {
         psError(PS_ERR_UNKNOWN, false,
                 "Moving to negative HDU didn't fail.");
@@ -365,5 +377,6 @@
     // check to see if given a extension greater than the total #HDUs, it errors.
     psLogMsg(__func__,PS_LOG_INFO, "Following should be an error.");
-    if (psFitsMoveExtNum(fits, numHDUs, false) ) {
+    psErrorClear();
+    if (psFitsMoveExtNum(fits, numHDUs, false) || psErrorGetStackSize() != 1) {
         psError(PS_ERR_UNKNOWN, false,
                 "Moving to a HDU beyond the file's contents didn't fail.");
@@ -374,5 +387,6 @@
     psFitsMoveExtNum(fits,numHDUs-1,false);
     psLogMsg(__func__,PS_LOG_INFO, "Following should be an error.");
-    if (psFitsMoveExtNum(fits, 1, true) ) {
+    psErrorClear();
+    if (psFitsMoveExtNum(fits, 1, true) || psErrorGetStackSize() != 1) {
         psError(PS_ERR_UNKNOWN, false,
                 "Moving to negative HDU didn't fail.");
@@ -382,5 +396,6 @@
     // check to see if given a NULL psFits, it errors.
     psLogMsg(__func__,PS_LOG_INFO, "Following should be an error.");
-    if (psFitsMoveExtNum(NULL, 0, false) ) {
+    psErrorClear();
+    if (psFitsMoveExtNum(NULL, 0, false) || psErrorGetStackSize() != 1) {
         psError(PS_ERR_UNKNOWN, false,
                 "Operation of NULL psFits didn't fail.");
