Changeset 3333 for trunk/psLib/test/astronomy/tst_psCoord.c
- Timestamp:
- Feb 25, 2005, 12:27:38 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/astronomy/tst_psCoord.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/astronomy/tst_psCoord.c
r3331 r3333 6 6 * @author GLG, MHPCC 7 7 * 8 * @version $Revision: 1.1 7$ $Name: not supported by cvs2svn $9 * @date $Date: 2005-02-25 2 0:50:35$8 * @version $Revision: 1.18 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2005-02-25 22:27:37 $ 10 10 * 11 11 * XXX: Must test psSpherePrecess. … … 31 31 static psS32 testSphereTransformICRSToEcliptic( void ); 32 32 static psS32 testSphereTransformEclipticToICRS( void ); 33 static psS32 test 7( void );34 static psS32 test 8( void );33 static psS32 testSphereTransformICRSToGalactic( void ); 34 static psS32 testSphereTransformGalacticToICRS( void ); 35 35 //static psS32 test20( void ); 36 36 //static psS32 test21( void ); … … 49 49 {testSphereTransformICRSToEcliptic, 821, "psSphereTransformICRSToEcliptic()", 0, false}, 50 50 {testSphereTransformEclipticToICRS, 822, "psSphereTransformEclipticToICRS()", 0, false}, 51 {test 7, 0000, "psSphereTransformICRSToGalatic()", 0, false},52 {test 8, 0000, "psSphereTransformGalaticToICRS()", 0, false},51 {testSphereTransformICRSToGalactic, 824, "psSphereTransformICRSToGalactic()", 0, false}, 52 {testSphereTransformGalacticToICRS, 823, "psSphereTransformGalacticToICRS()", 0, false}, 53 53 // {test20, 0000, "psProject()", 0, false}, 54 54 // {test21, 0000, "psDeProject()", 0, false}, … … 778 778 } 779 779 780 psS32 test7( void ) 781 { 782 psS32 testStatus = 0; 783 // XXX: This test code is simply a copy of the original source code. 784 psF64 expectedAlphaP = DEG_TO_RAD(32.93192); 785 psF64 expectedDeltaP = DEG_TO_RAD(-62.87175); 786 psF64 expectedPhiP = DEG_TO_RAD(282.85948); 787 psSphereTransform *myST = psSphereTransformICRSToGalatic(); 788 789 if (FLT_EPSILON < fabs(sin(expectedDeltaP) - myST->sinDeltaP)) { 790 printf("ERROR: myST->sinDeltaP is %f, should be %f\n", myST->sinDeltaP, sin(expectedDeltaP)); 791 testStatus = 1; 792 } 793 794 if (FLT_EPSILON < fabs(cos(expectedDeltaP) - myST->cosDeltaP)) { 795 printf("ERROR: myST->cosDeltaP is %f, should be %f\n", myST->cosDeltaP, cos(expectedDeltaP)); 796 testStatus = 1; 797 } 798 799 if (FLT_EPSILON < fabs(expectedAlphaP - myST->alphaP)) { 800 printf("ERROR: myST->alphaP is %f, should be %f\n", myST->alphaP, expectedAlphaP); 801 testStatus = 3; 802 } 803 804 if (FLT_EPSILON < fabs(expectedPhiP - myST->phiP)) { 805 printf("ERROR: myST->phiP is %f, should be %f\n", myST->phiP, expectedPhiP); 806 testStatus = 4; 807 } 808 780 #define ITG_EXPECT_PHIP 4.93683 781 #define ITG_EXPECT_SINDELTAP -0.88999 782 #define ITG_EXPECT_COSDELTAP 0.45598 783 #define ITG_EXPECT_ALPHAP 0.57477 784 785 psS32 testSphereTransformICRSToGalactic( void ) 786 { 787 // Invoke function 788 psSphereTransform *myST = psSphereTransformICRSToGalactic(); 789 790 // Verify did not return NULL 791 if(myST == NULL) { 792 psError(PS_ERR_UNKNOWN,true,"psSphereTransformICRSToGalactic returned NULL"); 793 return 1; 794 } 795 // Verify returned structure has members set properly 796 if (ERROR_TOL < fabs(ITG_EXPECT_SINDELTAP - myST->sinDeltaP)) { 797 psError(PS_ERR_UNKNOWN,true,"myST->sinDeltaP is %f, should be %f", 798 myST->sinDeltaP, ITG_EXPECT_SINDELTAP); 799 return 2; 800 } 801 if (ERROR_TOL < fabs(ITG_EXPECT_COSDELTAP - myST->cosDeltaP)) { 802 psError(PS_ERR_UNKNOWN,true,"myST->cosDeltaP is %f, should be %f", 803 myST->cosDeltaP, ITG_EXPECT_COSDELTAP); 804 return 3; 805 } 806 if (ERROR_TOL < fabs(ITG_EXPECT_ALPHAP - myST->alphaP)) { 807 psError(PS_ERR_UNKNOWN,true,"myST->alphaP is %f, should be %f", 808 myST->alphaP, ITG_EXPECT_ALPHAP); 809 return 4; 810 } 811 if (ERROR_TOL < fabs(ITG_EXPECT_PHIP - myST->phiP)) { 812 psError(PS_ERR_UNKNOWN,true,"myST->phiP is %f, should be %f", 813 myST->phiP, ITG_EXPECT_PHIP); 814 return 5; 815 } 816 // Free data structure created 809 817 psFree(myST); 810 return(testStatus); 811 } 812 813 psS32 test8( void ) 814 { 815 psS32 testStatus = 0; 816 // XXX: This test code is simply a copy of the original source code. 817 psF64 expectedAlphaP = DEG_TO_RAD(282.85948); 818 psF64 expectedDeltaP = DEG_TO_RAD(62.87175); 819 psF64 expectedPhiP = DEG_TO_RAD(32.93192); 820 psSphereTransform *myST = psSphereTransformGalaticToICRS(); 821 822 if (FLT_EPSILON < fabs(sin(expectedDeltaP) - myST->sinDeltaP)) { 823 printf("ERROR: myST->sinDeltaP is %f, should be %f\n", myST->sinDeltaP, sin(expectedDeltaP)); 824 testStatus = 1; 825 } 826 827 if (FLT_EPSILON < fabs(cos(expectedDeltaP) - myST->cosDeltaP)) { 828 printf("ERROR: myST->cosDeltaP is %f, should be %f\n", myST->cosDeltaP, cos(expectedDeltaP)); 829 testStatus = 1; 830 } 831 832 if (FLT_EPSILON < fabs(expectedAlphaP - myST->alphaP)) { 833 printf("ERROR: myST->alphaP is %f, should be %f\n", myST->alphaP, expectedAlphaP); 834 testStatus = 3; 835 } 836 837 if (FLT_EPSILON < fabs(expectedPhiP - myST->phiP)) { 838 printf("ERROR: myST->phiP is %f, should be %f\n", myST->phiP, expectedPhiP); 839 testStatus = 4; 840 } 841 818 819 return 0; 820 } 821 822 #define GTI_EXPECT_ALPHAP 4.93683 823 #define GTI_EXPECT_SINDELTAP 0.88999 824 #define GTI_EXPECT_COSDELTAP 0.45598 825 #define GTI_EXPECT_PHIP 0.57477 826 827 psS32 testSphereTransformGalacticToICRS( void ) 828 { 829 // Invoke function 830 psSphereTransform *myST = psSphereTransformGalacticToICRS(); 831 832 // Verify did not return NULL 833 if(myST == NULL) { 834 psError(PS_ERR_UNKNOWN,true,"psSphereTransformGalacticToICRS returned NULL"); 835 return 1; 836 } 837 // Verify returned structure has members set properly 838 if (ERROR_TOL < fabs(GTI_EXPECT_SINDELTAP - myST->sinDeltaP)) { 839 psError(PS_ERR_UNKNOWN,true,"myST->sinDeltaP is %f, should be %f", 840 myST->sinDeltaP, GTI_EXPECT_SINDELTAP); 841 return 2; 842 } 843 if (ERROR_TOL < fabs(GTI_EXPECT_COSDELTAP - myST->cosDeltaP)) { 844 psError(PS_ERR_UNKNOWN,true,"myST->cosDeltaP is %f, should be %f", 845 myST->cosDeltaP, GTI_EXPECT_COSDELTAP); 846 return 3; 847 } 848 if (ERROR_TOL < fabs(GTI_EXPECT_ALPHAP - myST->alphaP)) { 849 psError(PS_ERR_UNKNOWN,true,"myST->alphaP is %f, should be %f", 850 myST->alphaP, GTI_EXPECT_ALPHAP); 851 return 4; 852 } 853 if (ERROR_TOL < fabs(GTI_EXPECT_PHIP - myST->phiP)) { 854 psError(PS_ERR_UNKNOWN,true,"myST->phiP is %f, should be %f", 855 myST->phiP, GTI_EXPECT_PHIP); 856 return 5; 857 } 858 // Free data structure created 842 859 psFree(myST); 843 return(testStatus); 860 861 return 0; 844 862 } 845 863
Note:
See TracChangeset
for help on using the changeset viewer.
