Changeset 3331
- Timestamp:
- Feb 25, 2005, 10:50:35 AM (21 years ago)
- Location:
- trunk/psLib/test/astronomy
- Files:
-
- 3 edited
-
tst_psCoord.c (modified) (7 diffs)
-
verified/tst_psCoord.stderr (modified) (1 diff)
-
verified/tst_psCoord.stdout (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/astronomy/tst_psCoord.c
r3324 r3331 6 6 * @author GLG, MHPCC 7 7 * 8 * @version $Revision: 1.1 6$ $Name: not supported by cvs2svn $9 * @date $Date: 2005-02-25 02:47:53$8 * @version $Revision: 1.17 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2005-02-25 20:50:35 $ 10 10 * 11 11 * XXX: Must test psSpherePrecess. … … 30 30 static psS32 testSphereTransformApply2( void ); 31 31 static psS32 testSphereTransformICRSToEcliptic( void ); 32 static psS32 test 6( void );32 static psS32 testSphereTransformEclipticToICRS( void ); 33 33 static psS32 test7( void ); 34 34 static psS32 test8( void ); … … 47 47 {testSphereTransformApply1, 820, "psPSphereTransformApply()", 0, false}, 48 48 {testSphereTransformApply2, 820, "psPSphereTransformApply()", 0, false}, 49 {testSphereTransformICRSToEcliptic, 0000, "psSphereTransformICRSToEcliptic()", 0, false},50 {test 6, 0000, "psSphereTransformEclipticToICRS()", 0, false},49 {testSphereTransformICRSToEcliptic, 821, "psSphereTransformICRSToEcliptic()", 0, false}, 50 {testSphereTransformEclipticToICRS, 822, "psSphereTransformEclipticToICRS()", 0, false}, 51 51 {test7, 0000, "psSphereTransformICRSToGalatic()", 0, false}, 52 52 {test8, 0000, "psSphereTransformGalaticToICRS()", 0, false}, … … 589 589 // Thes values calculated from ADD-09 equations 590 590 #define EXPECT_COS_DELTAP_2000 0.917482 591 #define EXPECT_SIN_DELTAP_2000 -0.397777591 #define EXPECT_SIN_DELTAP_2000 0.397777 592 592 #define EXPECT_COS_DELTAP_2100 0.917572 593 #define EXPECT_SIN_DELTAP_2100 -0.397567593 #define EXPECT_SIN_DELTAP_2100 0.397567 594 594 595 595 #define ERROR_TOL 0.0001 … … 600 600 psF64 expectedAlphaP = 0.0; 601 601 psF64 expectedCosDeltaP = EXPECT_COS_DELTAP_2000; 602 psF64 expectedSinDeltaP = EXPECT_SIN_DELTAP_2000;602 psF64 expectedSinDeltaP = -EXPECT_SIN_DELTAP_2000; 603 603 604 604 // Set test date time to 1/1/2000 00:00:00 … … 633 633 634 634 expectedCosDeltaP = EXPECT_COS_DELTAP_2100; 635 expectedSinDeltaP = EXPECT_SIN_DELTAP_2100;635 expectedSinDeltaP = -EXPECT_SIN_DELTAP_2100; 636 636 637 637 // Set test date time to 1/1/2100 00:00:00 … … 687 687 688 688 689 psS32 test6( void ) 690 { 691 psS32 testStatus = 0; 692 psTime* now = psTimeGetTime(PS_TIME_UTC); 693 struct tm *tm_time = psTimeToTM(now); 694 psF64 MJD = psTimeToMJD(now); 695 struct tm *tmTime = psTimeToTM(now); 696 psF64 year = (psF64)(1900 - MJD + tmTime->tm_year); 697 psF64 T = year / 100.0; 698 psF64 expectedAlphaP = 0.0; 699 psF64 expectedDeltaP = DEG_TO_RAD(23.0) + 700 SEC_TO_RAD(27.0) + 701 MIN_TO_RAD(8.0) - 702 (SEC_TO_RAD(46.845) * T) - 703 (SEC_TO_RAD(0.0059) * T * T) + 704 (SEC_TO_RAD(0.00181) * T * T * T); 705 psF64 expectedPhiP = 0.0; 706 psSphereTransform *myST = psSphereTransformEclipticToICRS(now); 707 708 if (FLT_EPSILON < fabs(sin(expectedDeltaP) - myST->sinDeltaP)) { 709 printf("ERROR: myST->sinDeltaP is %f, should be %f\n", myST->sinDeltaP, sin(expectedDeltaP)); 710 testStatus = 1; 711 } 712 713 if (FLT_EPSILON < fabs(cos(expectedDeltaP) - myST->cosDeltaP)) { 714 printf("ERROR: myST->cosDeltaP is %f, should be %f\n", myST->cosDeltaP, cos(expectedDeltaP)); 715 testStatus = 1; 716 } 717 718 if (FLT_EPSILON < fabs(expectedAlphaP - myST->alphaP)) { 719 printf("ERROR: myST->alphaP is %f, should be %f\n", myST->alphaP, expectedAlphaP); 720 testStatus = 3; 721 } 722 723 if (FLT_EPSILON < fabs(expectedPhiP - myST->phiP)) { 724 printf("ERROR: myST->phiP is %f, should be %f\n", myST->phiP, expectedPhiP); 725 testStatus = 4; 726 } 727 689 psS32 testSphereTransformEclipticToICRS( void ) 690 { 691 psF64 expectedPhiP = 0.0; 692 psF64 expectedAlphaP = 0.0; 693 psF64 expectedCosDeltaP = EXPECT_COS_DELTAP_2000; 694 psF64 expectedSinDeltaP = EXPECT_SIN_DELTAP_2000; 695 696 // Set test date time to 1/1/2000 00:00:00 697 psTime* testDateTime = psTimeFromMJD(MJD_2000); 698 699 // Invoke function to set psSphereTransforma object 700 psSphereTransform *myST = psSphereTransformEclipticToICRS(testDateTime); 701 702 // Verify expected values for the specified time 703 if (ERROR_TOL < fabs(expectedSinDeltaP - myST->sinDeltaP)) { 704 psError(PS_ERR_UNKNOWN,true,"myST->sinDeltaP is %f, should be %f", 705 myST->sinDeltaP, expectedSinDeltaP); 706 return 1; 707 } 708 if (ERROR_TOL < fabs(expectedCosDeltaP - myST->cosDeltaP)) { 709 psError(PS_ERR_UNKNOWN,true,"myST->cosDeltaP is %f, should be %f", 710 myST->cosDeltaP, expectedCosDeltaP); 711 return 2; 712 } 713 if (ERROR_TOL < fabs(expectedAlphaP - myST->alphaP)) { 714 psError(PS_ERR_UNKNOWN,true,"myST->alphaP is %f, should be %f", 715 myST->alphaP, expectedAlphaP); 716 return 3; 717 } 718 if (ERROR_TOL < fabs(expectedPhiP - myST->phiP)) { 719 psError(PS_ERR_UNKNOWN,true,"myST->phiP is %f, should be %f", 720 myST->phiP, expectedPhiP); 721 return 4; 722 } 728 723 psFree(myST); 729 psFree(tm_time); 730 psFree(tmTime); 731 psFree(now); 732 733 printf("-------------------------------------------------------------------\n"); 734 printf("Calling psSphereTransformEclipticToICRS() with NULL input. Should generate error, return NULL.\n"); 724 psFree(testDateTime); 725 726 expectedCosDeltaP = EXPECT_COS_DELTAP_2100; 727 expectedSinDeltaP = EXPECT_SIN_DELTAP_2100; 728 729 // Set test date time to 1/1/2100 00:00:00 730 testDateTime = psTimeFromMJD(MJD_2100); 731 732 // Invoke function to set psSphereTransforma objec 733 myST = psSphereTransformEclipticToICRS(testDateTime); 734 735 // Verify expected values for the specified time 736 if (ERROR_TOL < fabs(expectedSinDeltaP - myST->sinDeltaP)) { 737 psError(PS_ERR_UNKNOWN,true,"myST->sinDeltaP is %f, should be %f", 738 myST->sinDeltaP, expectedSinDeltaP); 739 return 5; 740 } 741 if (ERROR_TOL < fabs(expectedCosDeltaP - myST->cosDeltaP)) { 742 psError(PS_ERR_UNKNOWN,true,"myST->cosDeltaP is %f, should be %f", 743 myST->cosDeltaP, expectedCosDeltaP); 744 return 6; 745 } 746 if (ERROR_TOL < fabs(expectedAlphaP - myST->alphaP)) { 747 psError(PS_ERR_UNKNOWN,true,"myST->alphaP is %f, should be %f", 748 myST->alphaP, expectedAlphaP); 749 return 7; 750 } 751 if (ERROR_TOL < fabs(expectedPhiP - myST->phiP)) { 752 psError(PS_ERR_UNKNOWN,true,"myST->phiP is %f, should be %f", 753 myST->phiP, expectedPhiP); 754 return 8; 755 } 756 psFree(myST); 757 psFree(testDateTime); 758 759 // Verify if argument psTime is NULL, function returns NULL and error message generated 760 psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message"); 735 761 myST = psSphereTransformEclipticToICRS(NULL); 736 762 if (myST != NULL) { 737 printf("TEST ERROR: psSphereTransformApply() did not return NULL.\n"); 738 testStatus = false; 739 myST = NULL; 740 } 741 742 return(testStatus); 763 psError(PS_ERR_UNKNOWN,true,"psSphereTransformEclipticICRS() did not return NULL."); 764 return 9; 765 } 766 767 // Verify if argument psTime is less than 1900, function return NULL and error msg generated 768 psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message"); 769 testDateTime = psTimeFromMJD(MJD_1900 - 1.0); 770 myST = psSphereTransformEclipticToICRS(testDateTime); 771 if (myST != NULL) { 772 psError(PS_ERR_UNKNOWN,true,"psSphereTransformEclipticToICRS() did not return NULL."); 773 return 10; 774 } 775 psFree(testDateTime); 776 777 return 0; 743 778 } 744 779 -
trunk/psLib/test/astronomy/verified/tst_psCoord.stderr
r3324 r3331 121 121 \**********************************************************************************/ 122 122 123 <DATE><TIME>|<HOST>|I|testSphereTransformEclipticToICRS 124 Following should generate an error message 123 125 <DATE><TIME>|<HOST>|E|psSphereTransformEclipticToICRS (FILE:LINENO) 124 126 Unallowable operation: time is NULL. 127 <DATE><TIME>|<HOST>|I|testSphereTransformEclipticToICRS 128 Following should generate an error message 129 <DATE><TIME>|<HOST>|E|psSphereTransformEclipticToICRS (FILE:LINENO) 130 Specified time is less than 1900. 125 131 126 132 ---> TESTPOINT PASSED (psCoord{psSphereTransformEclipticToICRS()} | tst_psCoord.c) -
trunk/psLib/test/astronomy/verified/tst_psCoord.stdout
r3324 r3331 32 32 ------------------------------------------------------------------- 33 33 ------------------------------------------------------------------- 34 Calling psSphereTransformEclipticToICRS() with NULL input. Should generate error, return NULL.35 -------------------------------------------------------------------36 34 Calling psSphereGetOffset() with NULL position1. Should generate error, return NULL. 37 35 -------------------------------------------------------------------
Note:
See TracChangeset
for help on using the changeset viewer.
