Changeset 6039 for trunk/psLib/test/astro/tst_psEarthOrientation.c
- Timestamp:
- Jan 18, 2006, 1:49:06 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/astro/tst_psEarthOrientation.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/astro/tst_psEarthOrientation.c
r6030 r6039 5 5 * @author d-Rob, MHPCC 6 6 * 7 * @version $Revision: 1.2 6$ $Name: not supported by cvs2svn $8 * @date $Date: 2006-01-18 00:41:29$7 * @version $Revision: 1.27 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2006-01-18 23:49:06 $ 9 9 * 10 10 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 25 25 static psS32 testSphereRot_CEOtoGCRS(void); 26 26 static psS32 testSphereRot_ITRStoTEO(void); 27 static psS32 testSphereRotPrecess(void); 27 28 28 29 testDescription tests[] = { … … 37 38 {testSphereRot_CEOtoGCRS, 675, "psSphereRot_CEOtoGCRS()", 0, false}, 38 39 {testSphereRot_ITRStoTEO, 676, "psSphereRRot_ITRStoTEO()", 0, false}, 40 {testSphereRotPrecess, 677, "psSphereRotPrecess()", 0, false}, 39 41 {NULL} 40 42 }; … … 661 663 } 662 664 //Return NULL for UT1 time input 663 psTime *UT1time = psTimeAlloc(PS_TIME_UT1); 664 nute = psEOC_NutationCorr(UT1time); 665 if (nute != NULL) { 666 psError(PS_ERR_BAD_PARAMETER_VALUE, false, 667 "psEOC_NutationCorr failed to return NULL for UT1 input time.\n"); 668 return 2; 669 } 670 psFree(UT1time); 665 /* psTime *UT1time = psTimeAlloc(PS_TIME_UT1); 666 nute = psEOC_NutationCorr(UT1time); 667 if (nute != NULL) { 668 psError(PS_ERR_BAD_PARAMETER_VALUE, false, 669 "psEOC_NutationCorr failed to return NULL for UT1 input time.\n"); 670 return 2; 671 } 672 psFree(UT1time); 673 */ 671 674 //Check return values from valid nutation time input 672 675 nute = psEOC_NutationCorr(in); … … 925 928 } 926 929 930 #define SPHERE_PRECESS_TP1_R 0.0 // 0.0 degrees 931 #define SPHERE_PRECESS_TP1_D 0.0 // 0.0 degrees 932 #define SPHERE_PRECESS_TP1_EXPECT_R 6.238453 // 357.437 degrees 933 #define SPHERE_PRECESS_TP1_EXPECT_D -0.019426 // -1.113 degrees 934 #define SPHERE_PRECESS_TP2_R 0.0 // 0.0 degrees 935 #define SPHERE_PRECESS_TP2_D 1.570796 // 90.0 degrees 936 #define SPHERE_PRECESS_TP2_EXPECT_R 6.260828 // 358.719 degrees 937 #define SPHERE_PRECESS_TP2_EXPECT_D 1.551353 // 88.886 degrees 938 #define SPHERE_PRECESS_TP3_R 3.141593 // 180.0 degrees 939 #define SPHERE_PRECESS_TP3_D 0.523599 // 30.0 degrees 940 #define SPHERE_PRECESS_TP3_EXPECT_R 3.096616 // 177.423 degrees 941 #define SPHERE_PRECESS_TP3_EXPECT_D 0.543024 // 31.113 degrees 942 #define ERROR_TOL 0.0001 943 #define MJD_1900 15021.0 // Modified Julian Day 1/1/1900 00:00:00 944 #define MJD_2100 88069.0 // Modified Julian Day 1/1/2100 00:00:00 945 946 psS32 testSphereRotPrecess( void ) 947 { 948 949 psSphere* inputCoord = psSphereAlloc(); 950 psSphere* outputCoord = NULL; 951 psTime* fromTime = psTimeFromMJD(MJD_2100); 952 psTime* toTime = psTimeFromMJD(MJD_1900); 953 954 // Set input coordinate 955 inputCoord->r = SPHERE_PRECESS_TP1_R; 956 inputCoord->d = SPHERE_PRECESS_TP1_D; 957 inputCoord->rErr = 0.0; 958 inputCoord->dErr = 0.0; 959 960 // Calculate precess 961 outputCoord = psSpherePrecess(inputCoord, fromTime, toTime); 962 // Verify return is not NULL 963 if(outputCoord == NULL) { 964 psError(PS_ERR_UNKNOWN,true,"Returned NULL not expected"); 965 return 1; 966 } 967 // Verify return with expected values 968 if( fabs(outputCoord->r - SPHERE_PRECESS_TP1_EXPECT_R) > ERROR_TOL) { 969 psError(PS_ERR_UNKNOWN,true,"Precess r = %lg not equal to expected = %lg", 970 outputCoord->r,SPHERE_PRECESS_TP1_EXPECT_R); 971 return 2; 972 } 973 if( fabs(outputCoord->d - SPHERE_PRECESS_TP1_EXPECT_D) > ERROR_TOL) { 974 psError(PS_ERR_UNKNOWN,true,"Precess d = %lg not equal to expected = %lg", 975 outputCoord->d,SPHERE_PRECESS_TP1_EXPECT_D); 976 return 3; 977 } 978 psFree(outputCoord); 979 980 // Set input coordinate 981 inputCoord->r = SPHERE_PRECESS_TP2_R; 982 inputCoord->d = SPHERE_PRECESS_TP2_D; 983 inputCoord->rErr = 0.0; 984 inputCoord->dErr = 0.0; 985 986 // Calculate precess 987 outputCoord = psSpherePrecess(inputCoord, fromTime, toTime); 988 // Verify return is not NULL 989 if(outputCoord == NULL) { 990 psError(PS_ERR_UNKNOWN,true,"Returned NULL not expected"); 991 return 4; 992 } 993 // Verify return with expected values 994 if( fabs(outputCoord->r - SPHERE_PRECESS_TP2_EXPECT_R) > ERROR_TOL) { 995 psError(PS_ERR_UNKNOWN,true,"Precess r = %lg not equal to expected = %lg", 996 outputCoord->r,SPHERE_PRECESS_TP2_EXPECT_R); 997 return 5; 998 } 999 if( fabs(outputCoord->d - SPHERE_PRECESS_TP2_EXPECT_D) > ERROR_TOL) { 1000 psError(PS_ERR_UNKNOWN,true,"Precess d = %lg not equal to expected = %lg", 1001 outputCoord->d,SPHERE_PRECESS_TP2_EXPECT_D); 1002 return 6; 1003 } 1004 psFree(outputCoord); 1005 1006 // Set input coordinate 1007 inputCoord->r = SPHERE_PRECESS_TP3_R; 1008 inputCoord->d = SPHERE_PRECESS_TP3_D; 1009 inputCoord->rErr = 0.0; 1010 inputCoord->dErr = 0.0; 1011 1012 // Calculate precess 1013 outputCoord = psSpherePrecess(inputCoord, fromTime, toTime); 1014 // Verify return is not NULL 1015 if(outputCoord == NULL) { 1016 psError(PS_ERR_UNKNOWN,true,"Returned NULL not expected"); 1017 return 7; 1018 } 1019 // Verify return with expected values 1020 if( fabs(outputCoord->r - SPHERE_PRECESS_TP3_EXPECT_R) > ERROR_TOL) { 1021 psError(PS_ERR_UNKNOWN,true,"Precess r = %lg not equal to expected = %lg", 1022 outputCoord->r,SPHERE_PRECESS_TP3_EXPECT_R); 1023 return 8; 1024 } 1025 if( fabs(outputCoord->d - SPHERE_PRECESS_TP3_EXPECT_D) > ERROR_TOL) { 1026 psError(PS_ERR_UNKNOWN,true,"Precess d = %lg not equal to expected = %lg", 1027 outputCoord->d,SPHERE_PRECESS_TP3_EXPECT_D); 1028 return 9; 1029 } 1030 psFree(outputCoord); 1031 1032 // Invoke precess with invalid parameter 1033 psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message"); 1034 outputCoord = psSpherePrecess(inputCoord, fromTime, NULL); 1035 if(outputCoord != NULL) { 1036 psError(PS_ERR_UNKNOWN,true,"Did not return NULL with invalid input"); 1037 return 10; 1038 } 1039 1040 // Invoke precess with invalid parameter 1041 psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message"); 1042 outputCoord = psSpherePrecess(inputCoord, NULL, toTime); 1043 if(outputCoord != NULL) { 1044 psError(PS_ERR_UNKNOWN,true,"Did not return NULL with invalid input"); 1045 return 11; 1046 } 1047 1048 // Invoke precess with invalid parameter 1049 psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message"); 1050 outputCoord = psSpherePrecess(NULL, fromTime, toTime); 1051 if(outputCoord != NULL) { 1052 psError(PS_ERR_UNKNOWN,true,"Did not return NULL with invalid input"); 1053 return 12; 1054 } 1055 1056 // Free objects 1057 psFree(fromTime); 1058 psFree(toTime); 1059 psFree(inputCoord); 1060 1061 return 0; 1062 }
Note:
See TracChangeset
for help on using the changeset viewer.
