Changeset 2968
- Timestamp:
- Jan 12, 2005, 4:20:44 PM (22 years ago)
- Location:
- trunk/psLib/test
- Files:
-
- 2 edited
-
dataIO/tst_psFits.c (modified) (11 diffs)
-
fileUtils/tst_psFits.c (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/dataIO/tst_psFits.c
r2967 r2968 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1. 3$ $Name: not supported by cvs2svn $9 * @date $Date: 2005-01-13 02: 08:30$8 * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2005-01-13 02:20:44 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 18 18 #include <string.h> 19 19 20 static bool makeMulti(void); 20 static bool makeMulti(void); // implicitly tests psFitsSetExtName 21 21 const char* multiFilename = "multi.fits"; 22 22 … … 184 184 // check to see if given a bogus extension name, it errors. 185 185 psLogMsg(__func__,PS_LOG_INFO, "Following should be an error."); 186 if (psFitsMoveExtName(fits, "bogus") ) {186 if (psFitsMoveExtName(fits, "bogus") || psErrorGetStackSize() != 1) { 187 187 psError(PS_ERR_UNKNOWN, false, 188 188 "Moving to non-existant HDU didn't fail."); … … 192 192 // check to see if given a NULL psFits, it errors. 193 193 psLogMsg(__func__,PS_LOG_INFO, "Following should be an error."); 194 if (psFitsMoveExtName(NULL, "bogus") ) {194 if (psFitsMoveExtName(NULL, "bogus") || psErrorGetStackSize() != 1) { 195 195 psError(PS_ERR_UNKNOWN, false, 196 196 "Operation of NULL psFits didn't fail."); … … 200 200 // check to see if given a NULL extname, it errors. 201 201 psLogMsg(__func__,PS_LOG_INFO, "Following should be an error."); 202 if (psFitsMoveExtName(fits, NULL) ) {202 if (psFitsMoveExtName(fits, NULL) || psErrorGetStackSize() != 1) { 203 203 psError(PS_ERR_UNKNOWN, false, 204 204 "Operation of NULL extname didn't fail."); … … 222 222 int numHDUs = psFitsGetSize(fits); 223 223 224 if (numHDUs < 2) { 224 // as a side test, let's make sure psFitsGetSize can handle NULL. 225 psLogMsg(__func__,PS_LOG_INFO, 226 "Following should be an error."); 227 psErrorClear(); 228 if (psFitsGetSize(NULL) != 0 || psErrorGetStackSize() != 1) { 229 psError(PS_ERR_UNKNOWN,true, 230 "The 'multi' FITS file does not have multiple HDUs."); 231 return 2; 232 } 233 234 if (numHDUs != 8) { 225 235 psError(PS_ERR_UNKNOWN,true, 226 236 "The 'multi' FITS file does not have multiple HDUs."); … … 347 357 // check to see if given a negative extension number, it errors. 348 358 psLogMsg(__func__,PS_LOG_INFO, "Following should be an error."); 349 if (psFitsMoveExtNum(fits, -1, false) ) { 359 psErrorClear(); 360 if (psFitsMoveExtNum(fits, -1, false) || psErrorGetStackSize() != 1) { 350 361 psError(PS_ERR_UNKNOWN, false, 351 362 "Moving to negative HDU didn't fail."); … … 356 367 psFitsMoveExtNum(fits,0,false); 357 368 psLogMsg(__func__,PS_LOG_INFO, "Following should be an error."); 358 if (psFitsMoveExtNum(fits, -1, true) ) { 369 psErrorClear(); 370 if (psFitsMoveExtNum(fits, -1, true) || psErrorGetStackSize() != 1) { 359 371 psError(PS_ERR_UNKNOWN, false, 360 372 "Moving to negative HDU didn't fail."); … … 365 377 // check to see if given a extension greater than the total #HDUs, it errors. 366 378 psLogMsg(__func__,PS_LOG_INFO, "Following should be an error."); 367 if (psFitsMoveExtNum(fits, numHDUs, false) ) { 379 psErrorClear(); 380 if (psFitsMoveExtNum(fits, numHDUs, false) || psErrorGetStackSize() != 1) { 368 381 psError(PS_ERR_UNKNOWN, false, 369 382 "Moving to a HDU beyond the file's contents didn't fail."); … … 374 387 psFitsMoveExtNum(fits,numHDUs-1,false); 375 388 psLogMsg(__func__,PS_LOG_INFO, "Following should be an error."); 376 if (psFitsMoveExtNum(fits, 1, true) ) { 389 psErrorClear(); 390 if (psFitsMoveExtNum(fits, 1, true) || psErrorGetStackSize() != 1) { 377 391 psError(PS_ERR_UNKNOWN, false, 378 392 "Moving to negative HDU didn't fail."); … … 382 396 // check to see if given a NULL psFits, it errors. 383 397 psLogMsg(__func__,PS_LOG_INFO, "Following should be an error."); 384 if (psFitsMoveExtNum(NULL, 0, false) ) { 398 psErrorClear(); 399 if (psFitsMoveExtNum(NULL, 0, false) || psErrorGetStackSize() != 1) { 385 400 psError(PS_ERR_UNKNOWN, false, 386 401 "Operation of NULL psFits didn't fail."); -
trunk/psLib/test/fileUtils/tst_psFits.c
r2967 r2968 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1. 3$ $Name: not supported by cvs2svn $9 * @date $Date: 2005-01-13 02: 08:30$8 * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2005-01-13 02:20:44 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 18 18 #include <string.h> 19 19 20 static bool makeMulti(void); 20 static bool makeMulti(void); // implicitly tests psFitsSetExtName 21 21 const char* multiFilename = "multi.fits"; 22 22 … … 184 184 // check to see if given a bogus extension name, it errors. 185 185 psLogMsg(__func__,PS_LOG_INFO, "Following should be an error."); 186 if (psFitsMoveExtName(fits, "bogus") ) {186 if (psFitsMoveExtName(fits, "bogus") || psErrorGetStackSize() != 1) { 187 187 psError(PS_ERR_UNKNOWN, false, 188 188 "Moving to non-existant HDU didn't fail."); … … 192 192 // check to see if given a NULL psFits, it errors. 193 193 psLogMsg(__func__,PS_LOG_INFO, "Following should be an error."); 194 if (psFitsMoveExtName(NULL, "bogus") ) {194 if (psFitsMoveExtName(NULL, "bogus") || psErrorGetStackSize() != 1) { 195 195 psError(PS_ERR_UNKNOWN, false, 196 196 "Operation of NULL psFits didn't fail."); … … 200 200 // check to see if given a NULL extname, it errors. 201 201 psLogMsg(__func__,PS_LOG_INFO, "Following should be an error."); 202 if (psFitsMoveExtName(fits, NULL) ) {202 if (psFitsMoveExtName(fits, NULL) || psErrorGetStackSize() != 1) { 203 203 psError(PS_ERR_UNKNOWN, false, 204 204 "Operation of NULL extname didn't fail."); … … 222 222 int numHDUs = psFitsGetSize(fits); 223 223 224 if (numHDUs < 2) { 224 // as a side test, let's make sure psFitsGetSize can handle NULL. 225 psLogMsg(__func__,PS_LOG_INFO, 226 "Following should be an error."); 227 psErrorClear(); 228 if (psFitsGetSize(NULL) != 0 || psErrorGetStackSize() != 1) { 229 psError(PS_ERR_UNKNOWN,true, 230 "The 'multi' FITS file does not have multiple HDUs."); 231 return 2; 232 } 233 234 if (numHDUs != 8) { 225 235 psError(PS_ERR_UNKNOWN,true, 226 236 "The 'multi' FITS file does not have multiple HDUs."); … … 347 357 // check to see if given a negative extension number, it errors. 348 358 psLogMsg(__func__,PS_LOG_INFO, "Following should be an error."); 349 if (psFitsMoveExtNum(fits, -1, false) ) { 359 psErrorClear(); 360 if (psFitsMoveExtNum(fits, -1, false) || psErrorGetStackSize() != 1) { 350 361 psError(PS_ERR_UNKNOWN, false, 351 362 "Moving to negative HDU didn't fail."); … … 356 367 psFitsMoveExtNum(fits,0,false); 357 368 psLogMsg(__func__,PS_LOG_INFO, "Following should be an error."); 358 if (psFitsMoveExtNum(fits, -1, true) ) { 369 psErrorClear(); 370 if (psFitsMoveExtNum(fits, -1, true) || psErrorGetStackSize() != 1) { 359 371 psError(PS_ERR_UNKNOWN, false, 360 372 "Moving to negative HDU didn't fail."); … … 365 377 // check to see if given a extension greater than the total #HDUs, it errors. 366 378 psLogMsg(__func__,PS_LOG_INFO, "Following should be an error."); 367 if (psFitsMoveExtNum(fits, numHDUs, false) ) { 379 psErrorClear(); 380 if (psFitsMoveExtNum(fits, numHDUs, false) || psErrorGetStackSize() != 1) { 368 381 psError(PS_ERR_UNKNOWN, false, 369 382 "Moving to a HDU beyond the file's contents didn't fail."); … … 374 387 psFitsMoveExtNum(fits,numHDUs-1,false); 375 388 psLogMsg(__func__,PS_LOG_INFO, "Following should be an error."); 376 if (psFitsMoveExtNum(fits, 1, true) ) { 389 psErrorClear(); 390 if (psFitsMoveExtNum(fits, 1, true) || psErrorGetStackSize() != 1) { 377 391 psError(PS_ERR_UNKNOWN, false, 378 392 "Moving to negative HDU didn't fail."); … … 382 396 // check to see if given a NULL psFits, it errors. 383 397 psLogMsg(__func__,PS_LOG_INFO, "Following should be an error."); 384 if (psFitsMoveExtNum(NULL, 0, false) ) { 398 psErrorClear(); 399 if (psFitsMoveExtNum(NULL, 0, false) || psErrorGetStackSize() != 1) { 385 400 psError(PS_ERR_UNKNOWN, false, 386 401 "Operation of NULL psFits didn't fail.");
Note:
See TracChangeset
for help on using the changeset viewer.
