Changeset 1942 for trunk/psLib/test/image/tst_psImageIO.c
- Timestamp:
- Oct 1, 2004, 4:09:21 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/image/tst_psImageIO.c (modified) (6 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 }
Note:
See TracChangeset
for help on using the changeset viewer.
