IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 2968


Ignore:
Timestamp:
Jan 12, 2005, 4:20:44 PM (22 years ago)
Author:
desonia
Message:

added test for psFitsGetSize.

Location:
trunk/psLib/test
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/test/dataIO/tst_psFits.c

    r2967 r2968  
    66*  @author Robert DeSonia, MHPCC
    77*
    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 $
    1010*
    1111*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    1818#include <string.h>
    1919
    20 static bool makeMulti(void);
     20static bool makeMulti(void);  // implicitly tests psFitsSetExtName
    2121const char* multiFilename = "multi.fits";
    2222
     
    184184    // check to see if given a bogus extension name, it errors.
    185185    psLogMsg(__func__,PS_LOG_INFO, "Following should be an error.");
    186     if (psFitsMoveExtName(fits, "bogus") ) {
     186    if (psFitsMoveExtName(fits, "bogus") || psErrorGetStackSize() != 1) {
    187187        psError(PS_ERR_UNKNOWN, false,
    188188                "Moving to non-existant HDU didn't fail.");
     
    192192    // check to see if given a NULL psFits, it errors.
    193193    psLogMsg(__func__,PS_LOG_INFO, "Following should be an error.");
    194     if (psFitsMoveExtName(NULL, "bogus") ) {
     194    if (psFitsMoveExtName(NULL, "bogus") || psErrorGetStackSize() != 1) {
    195195        psError(PS_ERR_UNKNOWN, false,
    196196                "Operation of NULL psFits didn't fail.");
     
    200200    // check to see if given a NULL extname, it errors.
    201201    psLogMsg(__func__,PS_LOG_INFO, "Following should be an error.");
    202     if (psFitsMoveExtName(fits, NULL) ) {
     202    if (psFitsMoveExtName(fits, NULL) || psErrorGetStackSize() != 1) {
    203203        psError(PS_ERR_UNKNOWN, false,
    204204                "Operation of NULL extname didn't fail.");
     
    222222    int numHDUs = psFitsGetSize(fits);
    223223
    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) {
    225235        psError(PS_ERR_UNKNOWN,true,
    226236                "The 'multi' FITS file does not have multiple HDUs.");
     
    347357    // check to see if given a negative extension number, it errors.
    348358    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) {
    350361        psError(PS_ERR_UNKNOWN, false,
    351362                "Moving to negative HDU didn't fail.");
     
    356367    psFitsMoveExtNum(fits,0,false);
    357368    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) {
    359371        psError(PS_ERR_UNKNOWN, false,
    360372                "Moving to negative HDU didn't fail.");
     
    365377    // check to see if given a extension greater than the total #HDUs, it errors.
    366378    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) {
    368381        psError(PS_ERR_UNKNOWN, false,
    369382                "Moving to a HDU beyond the file's contents didn't fail.");
     
    374387    psFitsMoveExtNum(fits,numHDUs-1,false);
    375388    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) {
    377391        psError(PS_ERR_UNKNOWN, false,
    378392                "Moving to negative HDU didn't fail.");
     
    382396    // check to see if given a NULL psFits, it errors.
    383397    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) {
    385400        psError(PS_ERR_UNKNOWN, false,
    386401                "Operation of NULL psFits didn't fail.");
  • trunk/psLib/test/fileUtils/tst_psFits.c

    r2967 r2968  
    66*  @author Robert DeSonia, MHPCC
    77*
    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 $
    1010*
    1111*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    1818#include <string.h>
    1919
    20 static bool makeMulti(void);
     20static bool makeMulti(void);  // implicitly tests psFitsSetExtName
    2121const char* multiFilename = "multi.fits";
    2222
     
    184184    // check to see if given a bogus extension name, it errors.
    185185    psLogMsg(__func__,PS_LOG_INFO, "Following should be an error.");
    186     if (psFitsMoveExtName(fits, "bogus") ) {
     186    if (psFitsMoveExtName(fits, "bogus") || psErrorGetStackSize() != 1) {
    187187        psError(PS_ERR_UNKNOWN, false,
    188188                "Moving to non-existant HDU didn't fail.");
     
    192192    // check to see if given a NULL psFits, it errors.
    193193    psLogMsg(__func__,PS_LOG_INFO, "Following should be an error.");
    194     if (psFitsMoveExtName(NULL, "bogus") ) {
     194    if (psFitsMoveExtName(NULL, "bogus") || psErrorGetStackSize() != 1) {
    195195        psError(PS_ERR_UNKNOWN, false,
    196196                "Operation of NULL psFits didn't fail.");
     
    200200    // check to see if given a NULL extname, it errors.
    201201    psLogMsg(__func__,PS_LOG_INFO, "Following should be an error.");
    202     if (psFitsMoveExtName(fits, NULL) ) {
     202    if (psFitsMoveExtName(fits, NULL) || psErrorGetStackSize() != 1) {
    203203        psError(PS_ERR_UNKNOWN, false,
    204204                "Operation of NULL extname didn't fail.");
     
    222222    int numHDUs = psFitsGetSize(fits);
    223223
    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) {
    225235        psError(PS_ERR_UNKNOWN,true,
    226236                "The 'multi' FITS file does not have multiple HDUs.");
     
    347357    // check to see if given a negative extension number, it errors.
    348358    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) {
    350361        psError(PS_ERR_UNKNOWN, false,
    351362                "Moving to negative HDU didn't fail.");
     
    356367    psFitsMoveExtNum(fits,0,false);
    357368    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) {
    359371        psError(PS_ERR_UNKNOWN, false,
    360372                "Moving to negative HDU didn't fail.");
     
    365377    // check to see if given a extension greater than the total #HDUs, it errors.
    366378    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) {
    368381        psError(PS_ERR_UNKNOWN, false,
    369382                "Moving to a HDU beyond the file's contents didn't fail.");
     
    374387    psFitsMoveExtNum(fits,numHDUs-1,false);
    375388    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) {
    377391        psError(PS_ERR_UNKNOWN, false,
    378392                "Moving to negative HDU didn't fail.");
     
    382396    // check to see if given a NULL psFits, it errors.
    383397    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) {
    385400        psError(PS_ERR_UNKNOWN, false,
    386401                "Operation of NULL psFits didn't fail.");
Note: See TracChangeset for help on using the changeset viewer.