Changeset 2993
- Timestamp:
- Jan 14, 2005, 9:21:55 AM (22 years ago)
- Location:
- trunk/psLib/test
- Files:
-
- 4 edited
-
dataIO/tst_psFits.c (modified) (4 diffs)
-
dataIO/verified/tst_psFits.stderr (modified) (1 diff)
-
fileUtils/tst_psFits.c (modified) (4 diffs)
-
fileUtils/verified/tst_psFits.stderr (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/dataIO/tst_psFits.c
r2974 r2993 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1. 5$ $Name: not supported by cvs2svn $9 * @date $Date: 2005-01-1 3 21:09:18$8 * @version $Revision: 1.6 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2005-01-14 19:21:55 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 25 25 static psS32 tst_psFitsMoveExtNum( void ); // also tests psFitsGetExtNum, psFitsGetSize 26 26 static psS32 tst_psFitsReadHeader( void ); 27 static psS32 tst_psFitsReadHeaderSet( void ); 27 28 28 29 testDescription tests[] = { … … 33 34 {tst_psFitsMoveExtNum, 803, "psFitsGetExtNum", 0, true}, 34 35 {tst_psFitsMoveExtNum, 803, "psFitsGetSize", 0, true}, 35 {tst_psFitsReadHeader, 0, "psFitsReadHeader", 0, false}, 36 {tst_psFitsReadHeader, 804, "psFitsReadHeader", 0, false}, 37 {tst_psFitsReadHeaderSet, 0, "psFitsReadHeaderSet", 0, false}, 36 38 {NULL} 37 39 }; … … 583 585 return 0; 584 586 } 587 588 static psS32 tst_psFitsReadHeaderSet( void ) 589 { 590 if (! makeMulti() ) { 591 return 1; 592 } 593 594 psFits* fits = psFitsAlloc(multiFilename); 595 596 int numHDUs = psFitsGetSize(fits); 597 598 if (numHDUs < 8) { 599 psError(PS_ERR_UNKNOWN,true, 600 "The 'multi' FITS file does not have multiple HDUs."); 601 return 2; 602 } 603 604 // move to the middle 605 psFitsMoveExtNum(fits,numHDUs/2, false); 606 607 psHash* headerSet = psFitsReadHeaderSet(NULL, fits); 608 609 if (headerSet == NULL) { 610 psError(PS_ERR_UNKNOWN, false, 611 "psFitsReadHeaderSet returned NULL unexpectedly."); 612 return 3; 613 } 614 615 if (psFitsGetExtNum(fits) != numHDUs/2) { 616 psError(PS_ERR_UNKNOWN, false, 617 "psFitsReadHeaderSet changed the CHU."); 618 return 4; 619 } 620 621 char extname[80]; 622 for (int i = 0; i < numHDUs; i++) { 623 if (i == 0) { 624 snprintf(extname, 80, "PHU"); 625 } else { 626 snprintf(extname, 80, "ext-%d", i); 627 } 628 629 psMetadata* header = psHashLookup(headerSet, extname); 630 631 if (header == NULL) { 632 psError(PS_ERR_UNKNOWN, false, 633 "psFitsReadHeader returned NULL unexpectedly for HDU#%d.", 634 i); 635 return 5; 636 } 637 638 psS32 intItem = psMetadataLookupS32(header, "MYINT",NULL); 639 640 if (intItem != i) { 641 psError(PS_ERR_UNKNOWN, false, 642 "psFitsReadHeader for HDU#%d had a MYINT of %d, expected %d.", 643 intItem, i); 644 return 6; 645 } 646 647 } 648 649 psHash* set2 = psHashAlloc(20); 650 651 if (psFitsReadHeaderSet(set2,NULL) != NULL) { 652 psError(PS_ERR_UNKNOWN, false, 653 "psFitsReadHeaderSet returned non-NULL given a NULL psFits."); 654 return 10; 655 } 656 657 psHash* set3 = psHashAlloc(20); 658 psFitsReadHeaderSet(set3,fits); 659 660 if (set3 == NULL) { 661 psError(PS_ERR_UNKNOWN, false, 662 "psFitsReadHeaderSet returned NULL unexpectedly."); 663 return 11; 664 } 665 666 for (int i = 0; i < numHDUs; i++) { 667 if (i == 0) { 668 snprintf(extname, 80, "PHU"); 669 } else { 670 snprintf(extname, 80, "ext-%d", i); 671 } 672 673 psMetadata* header = psHashLookup(set3, extname); 674 675 if (header == NULL) { 676 psError(PS_ERR_UNKNOWN, false, 677 "psFitsReadHeader returned NULL unexpectedly for HDU#%d.", 678 i); 679 return 5; 680 } 681 682 psS32 intItem = psMetadataLookupS32(header, "MYINT",NULL); 683 684 if (intItem != i) { 685 psError(PS_ERR_UNKNOWN, false, 686 "psFitsReadHeader for HDU#%d had a MYINT of %d, expected %d.", 687 intItem, i); 688 return 6; 689 } 690 691 } 692 693 694 695 psFree(headerSet); 696 psFree(set3); 697 // set2 should have been freed by psFitsReadHeaderSet upon an error. 698 699 psFree(fits); 700 701 return 0; 702 } -
trunk/psLib/test/dataIO/verified/tst_psFits.stderr
r2980 r2993 80 80 ---> TESTPOINT PASSED (psImage{psFitsReadHeader} | tst_psFits.c) 81 81 82 /***************************** TESTPOINT ******************************************\ 83 * TestFile: tst_psFits.c * 84 * TestPoint: psImage{psFitsReadHeaderSet} * 85 * TestType: Positive * 86 \**********************************************************************************/ 87 88 <DATE><TIME>|<HOST>|E|psFitsReadHeaderSet (psFits.c:<LINENO>) 89 The input psFits object can not NULL. 90 91 ---> TESTPOINT PASSED (psImage{psFitsReadHeaderSet} | tst_psFits.c) 92 -
trunk/psLib/test/fileUtils/tst_psFits.c
r2974 r2993 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1. 5$ $Name: not supported by cvs2svn $9 * @date $Date: 2005-01-1 3 21:09:18$8 * @version $Revision: 1.6 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2005-01-14 19:21:55 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 25 25 static psS32 tst_psFitsMoveExtNum( void ); // also tests psFitsGetExtNum, psFitsGetSize 26 26 static psS32 tst_psFitsReadHeader( void ); 27 static psS32 tst_psFitsReadHeaderSet( void ); 27 28 28 29 testDescription tests[] = { … … 33 34 {tst_psFitsMoveExtNum, 803, "psFitsGetExtNum", 0, true}, 34 35 {tst_psFitsMoveExtNum, 803, "psFitsGetSize", 0, true}, 35 {tst_psFitsReadHeader, 0, "psFitsReadHeader", 0, false}, 36 {tst_psFitsReadHeader, 804, "psFitsReadHeader", 0, false}, 37 {tst_psFitsReadHeaderSet, 0, "psFitsReadHeaderSet", 0, false}, 36 38 {NULL} 37 39 }; … … 583 585 return 0; 584 586 } 587 588 static psS32 tst_psFitsReadHeaderSet( void ) 589 { 590 if (! makeMulti() ) { 591 return 1; 592 } 593 594 psFits* fits = psFitsAlloc(multiFilename); 595 596 int numHDUs = psFitsGetSize(fits); 597 598 if (numHDUs < 8) { 599 psError(PS_ERR_UNKNOWN,true, 600 "The 'multi' FITS file does not have multiple HDUs."); 601 return 2; 602 } 603 604 // move to the middle 605 psFitsMoveExtNum(fits,numHDUs/2, false); 606 607 psHash* headerSet = psFitsReadHeaderSet(NULL, fits); 608 609 if (headerSet == NULL) { 610 psError(PS_ERR_UNKNOWN, false, 611 "psFitsReadHeaderSet returned NULL unexpectedly."); 612 return 3; 613 } 614 615 if (psFitsGetExtNum(fits) != numHDUs/2) { 616 psError(PS_ERR_UNKNOWN, false, 617 "psFitsReadHeaderSet changed the CHU."); 618 return 4; 619 } 620 621 char extname[80]; 622 for (int i = 0; i < numHDUs; i++) { 623 if (i == 0) { 624 snprintf(extname, 80, "PHU"); 625 } else { 626 snprintf(extname, 80, "ext-%d", i); 627 } 628 629 psMetadata* header = psHashLookup(headerSet, extname); 630 631 if (header == NULL) { 632 psError(PS_ERR_UNKNOWN, false, 633 "psFitsReadHeader returned NULL unexpectedly for HDU#%d.", 634 i); 635 return 5; 636 } 637 638 psS32 intItem = psMetadataLookupS32(header, "MYINT",NULL); 639 640 if (intItem != i) { 641 psError(PS_ERR_UNKNOWN, false, 642 "psFitsReadHeader for HDU#%d had a MYINT of %d, expected %d.", 643 intItem, i); 644 return 6; 645 } 646 647 } 648 649 psHash* set2 = psHashAlloc(20); 650 651 if (psFitsReadHeaderSet(set2,NULL) != NULL) { 652 psError(PS_ERR_UNKNOWN, false, 653 "psFitsReadHeaderSet returned non-NULL given a NULL psFits."); 654 return 10; 655 } 656 657 psHash* set3 = psHashAlloc(20); 658 psFitsReadHeaderSet(set3,fits); 659 660 if (set3 == NULL) { 661 psError(PS_ERR_UNKNOWN, false, 662 "psFitsReadHeaderSet returned NULL unexpectedly."); 663 return 11; 664 } 665 666 for (int i = 0; i < numHDUs; i++) { 667 if (i == 0) { 668 snprintf(extname, 80, "PHU"); 669 } else { 670 snprintf(extname, 80, "ext-%d", i); 671 } 672 673 psMetadata* header = psHashLookup(set3, extname); 674 675 if (header == NULL) { 676 psError(PS_ERR_UNKNOWN, false, 677 "psFitsReadHeader returned NULL unexpectedly for HDU#%d.", 678 i); 679 return 5; 680 } 681 682 psS32 intItem = psMetadataLookupS32(header, "MYINT",NULL); 683 684 if (intItem != i) { 685 psError(PS_ERR_UNKNOWN, false, 686 "psFitsReadHeader for HDU#%d had a MYINT of %d, expected %d.", 687 intItem, i); 688 return 6; 689 } 690 691 } 692 693 694 695 psFree(headerSet); 696 psFree(set3); 697 // set2 should have been freed by psFitsReadHeaderSet upon an error. 698 699 psFree(fits); 700 701 return 0; 702 } -
trunk/psLib/test/fileUtils/verified/tst_psFits.stderr
r2980 r2993 80 80 ---> TESTPOINT PASSED (psImage{psFitsReadHeader} | tst_psFits.c) 81 81 82 /***************************** TESTPOINT ******************************************\ 83 * TestFile: tst_psFits.c * 84 * TestPoint: psImage{psFitsReadHeaderSet} * 85 * TestType: Positive * 86 \**********************************************************************************/ 87 88 <DATE><TIME>|<HOST>|E|psFitsReadHeaderSet (psFits.c:<LINENO>) 89 The input psFits object can not NULL. 90 91 ---> TESTPOINT PASSED (psImage{psFitsReadHeaderSet} | tst_psFits.c) 92
Note:
See TracChangeset
for help on using the changeset viewer.
