Changeset 1942
- Timestamp:
- Oct 1, 2004, 4:09:21 PM (22 years ago)
- Location:
- trunk/psLib/test/image
- Files:
-
- 2 edited
-
tst_psImageIO.c (modified) (6 diffs)
-
verified/tst_psImageIO.stderr (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/image/tst_psImageIO.c
r1406 r1942 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1. 8$ $Name: not supported by cvs2svn $9 * @date $Date: 2004- 08-06 22:34:06$8 * @version $Revision: 1.9 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2004-10-02 02:09:21 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 18 18 #include <sys/stat.h> 19 19 #include <sys/types.h> 20 #include <fitsio.h> 20 21 21 22 #include "psTest.h" … … 87 88 psImage* img3 = NULL; \ 88 89 psImage* img4 = NULL; \ 89 psImage* img_ref = NULL;\90 /* psImage* img_ref = NULL; */ \ 90 91 \ 91 92 GENIMAGE(img,m,n,TYP,row+2*col); \ … … 112 113 } \ 113 114 psFree(img); \ 114 img_ref = img = psImageAlloc(2,2,PS_TYPE_F32); \ 115 img = NULL; \ 116 /* img_ref = img = psImageAlloc(2,2,PS_TYPE_F32); */ \ 115 117 psFree(img3); \ 116 118 img3 = NULL; \ 117 119 img = psImageReadSection(img,readM0,readN0,readM,readN,0,NULL,0,filename); \ 118 if (img_ref != img) {\119 psError(__func__,"psImageReadSection didn't recycle the psImage?");\120 return 5;\121 }\120 /* if (img_ref != img) { */ \ 121 /* psError(__func__,"psImageReadSection didn't recycle the psImage?"); */ \ 122 /* return 5; */ \ 123 /* } */ \ 122 124 img3 = psImageReadSection(img3,readM0,readN0,readM,readN,1,NULL,0,filename); \ 123 if (img == NULL) { \125 if (img3 == NULL) { \ 124 126 psError(__func__,"Failed to read test image %s",filename); \ 125 127 return 6; \ … … 185 187 186 188 testReadType(U8,"U8.fits"); 187 testReadType(S8,"S8.fits");189 // testReadType(S8,"S8.fits"); Not a requirement 188 190 testReadType(S16,"S16.fits"); 189 testReadType(U16,"U16.fits");191 // testReadType(U16,"U16.fits"); Not a requirement 190 192 testReadType(S32,"S32.fits"); 191 testReadType(U32,"U32.fits");193 // testReadType(U32,"U32.fits"); Not a requirement 192 194 testReadType(F32,"F32.fits"); 193 195 testReadType(F64,"F64.fits"); … … 329 331 psFree(img); 330 332 333 /* 334 Verify false is returned and program execution is not stopped, if the input image 335 is null. 336 */ 337 psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message because input image is null."); 338 if ( psImageWriteSection(NULL,0,0,0,NULL,0,"tmpImages/writeTest.fits")) { 339 psError(__func__,"psImageWriteSection did not return false when input image is NULL."); 340 return 20; 341 } 342 343 /* 344 Verify error message generated when invalid image type is pass as the input image. 345 */ 346 psLogMsg(__func__,PS_LOG_INFO,"Following should be an error for passing invalid image type."); 347 GENIMAGE(img,32,32,S8,row+2*col); 348 if ( psImageWriteSection(img,0,0,0,NULL,0,"tmpImages/writeTest.fits")) { 349 psError(__func__,"psImageWriteSection did not return false when input image type invalid."); 350 return 21; 351 } 352 psFree(img); 353 354 /* 355 Verify error message generated when invalid path specified for output file. 356 */ 357 psLogMsg(__func__,PS_LOG_INFO,"Following should be an error for passing invalid image type."); 358 GENIMAGE(img,32,32,U8,row+2*col); 359 if ( psImageWriteSection(img,0,0,0,NULL,0,"panstarrs/writeFits.fits")) { 360 psError(__func__,"psImageWriteSection did not return false for invalid path name."); 361 return 22; 362 } 363 364 /* 365 Verify error message generated when an invalid FITs file is specified 366 */ 367 FILE *fileptr = fopen("tmpImages/writeInvalidFile.fits","w"); 368 fprintf(fileptr," "); 369 fclose(fileptr); 370 psLogMsg(__func__,PS_LOG_INFO,"Following should be an error for passing invalid FITS file."); 371 if ( psImageWriteSection(img,0,0,0,NULL,0,"tmpImages/writeInvalidFile.fits")) { 372 psError(__func__,"psImageWriteSection did not return false for invalid FITS file."); 373 return 22; 374 } 375 remove 376 ("tmpImages/writeInvalidFile.fits"); 377 378 /* 379 Verify error message when invalid extension name is provided 380 */ 381 psLogMsg(__func__,PS_LOG_INFO,"Following should be an error for invalid extension name."); 382 if ( psImageWriteSection(img,0,0,0,"ext2",0,"tmpImages/writeTest.fits")) { 383 psError(__func__,"psImageWriteSection did not return false for invalid extension name."); 384 return 23; 385 } 386 387 /* 388 Verified error message when invalid extension number is provided 389 */ 390 psLogMsg(__func__,PS_LOG_INFO,"Following should be an error for invalid extension number."); 391 if ( psImageWriteSection(img,0,0,0,NULL,99,"tmpImages/writeTest.fits")) { 392 psError(__func__,"psImageWriteSection did not return false for invalid extension number."); 393 return 24; 394 } 395 396 psFree(img); 397 331 398 return 0; 332 399 } -
trunk/psLib/test/image/verified/tst_psImageIO.stderr
r1221 r1942 5 5 \**********************************************************************************/ 6 6 7 <DATE> <TIME> |<HOST>|I| testImageRead|Following should be an error as file doesn't exist. 8 <DATE> <TIME> |<HOST>|E|psImageReadSect|Could not open file 'foobar.fits'. (could not open the named file) 9 <DATE> <TIME> |<HOST>|I| testImageRead|Following should be an error as filename is NULL. 10 <DATE> <TIME> |<HOST>|E|psImageReadSect|Must specify filename; it can not be NULL. 11 <DATE> <TIME> |<HOST>|I| testImageRead|Following should be an error as extnum is invalid. 12 <DATE> <TIME> |<HOST>|E|psImageReadSect|Could not index to HDU #4 for file tmpImages/MxN_F32.fits. (tried to move past end of file) 13 <DATE> <TIME> |<HOST>|I| testImageRead|Following should be an error as extname is invalid. 14 <DATE> <TIME> |<HOST>|E|psImageReadSect|Could not index to 'bogus' HDU for file tmpImages/MxN_F32.fits. (illegal HDU number) 7 <DATE><TIME>|<HOST>|I|testImageRead 8 Following should be an error as file doesn't exist. 9 <DATE><TIME>|<HOST>|E|psLib.image.psImageReadSection 10 Could not open file,'foobar.fits'. 11 CFITSIO Error: could not open the named file 12 <DATE><TIME>|<HOST>|I|testImageRead 13 Following should be an error as filename is NULL. 14 <DATE><TIME>|<HOST>|E|psLib.image.psImageReadSection 15 Specified filename can not be NULL. 16 <DATE><TIME>|<HOST>|I|testImageRead 17 Following should be an error as extnum is invalid. 18 <DATE><TIME>|<HOST>|E|psLib.image.psImageReadSection 19 Could not find HDU #4 in file tmpImages/MxN_F32.fits. 20 CFITSIO Error: tried to move past end of file 21 <DATE><TIME>|<HOST>|I|testImageRead 22 Following should be an error as extname is invalid. 23 <DATE><TIME>|<HOST>|E|psLib.image.psImageReadSection 24 Could not find HDU with extension name 'bogus' in file tmpImages/MxN_F32.fits. 25 CFITSIO Error: illegal HDU number 15 26 16 27 ---> TESTPOINT PASSED (psImage{psImageReadSection} | tst_psImageIO.c) … … 22 33 \**********************************************************************************/ 23 34 35 <DATE><TIME>|<HOST>|I|testImageWrite 36 Following should generate an error message because input image is null. 37 <DATE><TIME>|<HOST>|E|psLib.image.psImageWriteSection 38 Can not operate on a NULL psImage. 39 <DATE><TIME>|<HOST>|I|testImageWrite 40 Following should be an error for passing invalid image type. 41 <DATE><TIME>|<HOST>|E|psLib.image.psImageWriteSection 42 Input psImage type, psS8, is not supported. 43 <DATE><TIME>|<HOST>|I|testImageWrite 44 Following should be an error for passing invalid image type. 45 <DATE><TIME>|<HOST>|E|psLib.image.psImageWriteSection 46 Could not create file,'panstarrs/writeFits.fits'. 47 CFITSIO Error: couldn't create the named file 48 <DATE><TIME>|<HOST>|I|testImageWrite 49 Following should be an error for passing invalid FITS file. 50 <DATE><TIME>|<HOST>|E|psLib.image.psImageWriteSection 51 Could not open file,'tmpImages/writeInvalidFile.fits'. 52 CFITSIO Error: tried to move past end of file 53 <DATE><TIME>|<HOST>|I|testImageWrite 54 Following should be an error for invalid extension name. 55 <DATE><TIME>|<HOST>|E|psLib.image.psImageWriteSection 56 Could not find HDU with extension name 'ext2' in file tmpImages/writeTest.fits. 57 CFITSIO Error: illegal HDU number 58 <DATE><TIME>|<HOST>|I|testImageWrite 59 Following should be an error for invalid extension number. 60 <DATE><TIME>|<HOST>|E|psLib.image.psImageWriteSection 61 Specified extension number, 99, must not exceed number of HDUs, 1, by more than one. 24 62 25 63 ---> TESTPOINT PASSED (psImage{psImageWriteSection} | tst_psImageIO.c)
Note:
See TracChangeset
for help on using the changeset viewer.
