Changeset 3360 for trunk/psLib/test/astronomy/tst_psCoord.c
- Timestamp:
- Mar 1, 2005, 5:40:38 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/astronomy/tst_psCoord.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/astronomy/tst_psCoord.c
r3352 r3360 6 6 * @author GLG, MHPCC 7 7 * 8 * @version $Revision: 1. 19$ $Name: not supported by cvs2svn $9 * @date $Date: 2005-03-0 1 21:40:28$8 * @version $Revision: 1.20 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2005-03-02 03:40:37 $ 10 10 * 11 11 * XXX: Must test psSpherePrecess. … … 36 36 static psS32 testSphereTransformICRSToGalactic( void ); 37 37 static psS32 testSphereTransformGalacticToICRS( void ); 38 static psS32 testSphereTransformPrecess(void); 38 39 //static psS32 test20( void ); 39 40 //static psS32 test21( void ); … … 57 58 {testSphereTransformICRSToGalactic, 824, "psSphereTransformICRSToGalactic()", 0, false}, 58 59 {testSphereTransformGalacticToICRS, 823, "psSphereTransformGalacticToICRS()", 0, false}, 60 {testSphereTransformPrecess, 825, "psSphereTransformPrecess()", 0, false}, 59 61 // {test20, 0000, "psProject()", 0, false}, 60 62 // {test21, 0000, "psDeProject()", 0, false}, … … 102 104 #define DELTA_P 2.0 103 105 #define PHI_P 3.0 106 104 107 psS32 testSphereTransformAlloc( void ) 105 108 { … … 850 853 psS32 testSphereTransformApply5( void) 851 854 { 852 853 855 psSphereTransform* testTransform; 854 856 psSphere* inputCoord = psSphereAlloc(); … … 956 958 psFree(inputCoord); 957 959 psFree(inverseOutputCoord); 960 961 return 0; 962 } 963 964 #define SPHERE_PRECESS_TP1_R 0.0 // 0.0 degrees 965 #define SPHERE_PRECESS_TP1_D 0.0 // 0.0 degrees 966 #define SPHERE_PRECESS_TP1_EXPECT_R 6.238453 // 357.437 degrees 967 #define SPHERE_PRECESS_TP1_EXPECT_D -0.019426 // -1.113 degrees 968 #define SPHERE_PRECESS_TP2_R 0.0 // 0.0 degrees 969 #define SPHERE_PRECESS_TP2_D 1.570796 // 90.0 degrees 970 #define SPHERE_PRECESS_TP2_EXPECT_R 6.260828 // 358.719 degrees 971 #define SPHERE_PRECESS_TP2_EXPECT_D 1.551353 // 88.886 degrees 972 #define SPHERE_PRECESS_TP3_R 3.141593 // 180.0 degrees 973 #define SPHERE_PRECESS_TP3_D 0.523599 // 30.0 degrees 974 #define SPHERE_PRECESS_TP3_EXPECT_R 3.096616 // 177.423 degrees 975 #define SPHERE_PRECESS_TP3_EXPECT_D 0.543024 // 31.113 degrees 976 977 psS32 testSphereTransformPrecess( void ) 978 { 979 psSphere* inputCoord = psSphereAlloc(); 980 psSphere* outputCoord = NULL; 981 psTime* fromTime = psTimeFromMJD(MJD_2100); 982 psTime* toTime = psTimeFromMJD(MJD_1900); 983 984 // Set input coordinate 985 inputCoord->r = SPHERE_PRECESS_TP1_R; 986 inputCoord->d = SPHERE_PRECESS_TP1_D; 987 inputCoord->rErr = 0.0; 988 inputCoord->dErr = 0.0; 989 990 // Calculate precess 991 outputCoord = psSpherePrecess(inputCoord, fromTime, toTime); 992 // Verify return with expected values 993 if( fabs(outputCoord->r - SPHERE_PRECESS_TP1_EXPECT_R) > ERROR_TOL) { 994 psError(PS_ERR_UNKNOWN,true,"Precess r = %lg not equal to expected = %lg", 995 outputCoord->r,SPHERE_PRECESS_TP1_EXPECT_R); 996 return 1; 997 } 998 if( fabs(outputCoord->d - SPHERE_PRECESS_TP1_EXPECT_D) > ERROR_TOL) { 999 psError(PS_ERR_UNKNOWN,true,"Precess d = %lg not equal to expected = %lg", 1000 outputCoord->d,SPHERE_PRECESS_TP1_EXPECT_D); 1001 return 2; 1002 } 1003 psFree(outputCoord); 1004 1005 // Set input coordinate 1006 inputCoord->r = SPHERE_PRECESS_TP2_R; 1007 inputCoord->d = SPHERE_PRECESS_TP2_D; 1008 inputCoord->rErr = 0.0; 1009 inputCoord->dErr = 0.0; 1010 1011 // Calculate precess 1012 outputCoord = psSpherePrecess(inputCoord, fromTime, toTime); 1013 // Verify return with expected values 1014 if( fabs(outputCoord->r - SPHERE_PRECESS_TP2_EXPECT_R) > ERROR_TOL) { 1015 psError(PS_ERR_UNKNOWN,true,"Precess r = %lg not equal to expected = %lg", 1016 outputCoord->r,SPHERE_PRECESS_TP2_EXPECT_R); 1017 return 3; 1018 } 1019 if( fabs(outputCoord->d - SPHERE_PRECESS_TP2_EXPECT_D) > ERROR_TOL) { 1020 psError(PS_ERR_UNKNOWN,true,"Precess d = %lg not equal to expected = %lg", 1021 outputCoord->d,SPHERE_PRECESS_TP2_EXPECT_D); 1022 return 4; 1023 } 1024 psFree(outputCoord); 1025 1026 // Set input coordinate 1027 inputCoord->r = SPHERE_PRECESS_TP3_R; 1028 inputCoord->d = SPHERE_PRECESS_TP3_D; 1029 inputCoord->rErr = 0.0; 1030 inputCoord->dErr = 0.0; 1031 1032 // Calculate precess 1033 outputCoord = psSpherePrecess(inputCoord, fromTime, toTime); 1034 // Verify return with expected values 1035 if( fabs(outputCoord->r - SPHERE_PRECESS_TP3_EXPECT_R) > ERROR_TOL) { 1036 psError(PS_ERR_UNKNOWN,true,"Precess r = %lg not equal to expected = %lg", 1037 outputCoord->r,SPHERE_PRECESS_TP3_EXPECT_R); 1038 return 5; 1039 } 1040 if( fabs(outputCoord->d - SPHERE_PRECESS_TP3_EXPECT_D) > ERROR_TOL) { 1041 psError(PS_ERR_UNKNOWN,true,"Precess d = %lg not equal to expected = %lg", 1042 outputCoord->d,SPHERE_PRECESS_TP3_EXPECT_D); 1043 return 6; 1044 } 1045 psFree(outputCoord); 1046 1047 // Invoke precess with invalid parameter 1048 psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message"); 1049 outputCoord = psSpherePrecess(inputCoord, fromTime, NULL); 1050 if(outputCoord != NULL) { 1051 psError(PS_ERR_UNKNOWN,true,"Did not return NULL with invalid input"); 1052 return 7; 1053 } 1054 1055 // Invoke precess with invalid parameter 1056 psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message"); 1057 outputCoord = psSpherePrecess(inputCoord, NULL, toTime); 1058 if(outputCoord != NULL) { 1059 psError(PS_ERR_UNKNOWN,true,"Did not return NULL with invalid input"); 1060 return 8; 1061 } 1062 1063 // Invoke precess with invalid parameter 1064 psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message"); 1065 outputCoord = psSpherePrecess(NULL, fromTime, toTime); 1066 if(outputCoord != NULL) { 1067 psError(PS_ERR_UNKNOWN,true,"Did not return NULL with invalid input"); 1068 return 9; 1069 } 1070 1071 // Free objects 1072 psFree(fromTime); 1073 psFree(toTime); 1074 psFree(inputCoord); 958 1075 959 1076 return 0;
Note:
See TracChangeset
for help on using the changeset viewer.
