Changeset 3324
- Timestamp:
- Feb 24, 2005, 4:47:54 PM (21 years ago)
- Location:
- trunk/psLib/test/astronomy
- Files:
-
- 3 edited
-
tst_psCoord.c (modified) (4 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
r3316 r3324 6 6 * @author GLG, MHPCC 7 7 * 8 * @version $Revision: 1.1 5$ $Name: not supported by cvs2svn $9 * @date $Date: 2005-02-2 4 20:21:40$8 * @version $Revision: 1.16 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2005-02-25 02:47:53 $ 10 10 * 11 11 * XXX: Must test psSpherePrecess. … … 29 29 static psS32 testSphereTransformApply1( void ); 30 30 static psS32 testSphereTransformApply2( void ); 31 static psS32 test 5( void );31 static psS32 testSphereTransformICRSToEcliptic( void ); 32 32 static psS32 test6( void ); 33 33 static psS32 test7( void ); … … 45 45 {test2, 0000, "psPlaneTransformApply()", 0, false}, 46 46 {test3, 0000, "psPlaneDistortApply()", 0, false}, 47 {testSphereTransformApply1, 0000, "psPSphereTransformApply()", 0, false},48 {testSphereTransformApply2, 0000, "psPSphereTransformApply()", 0, false},49 {test 5, 0000, "psSphereTransformICRSToEcliptic()", 0, false},47 {testSphereTransformApply1, 820, "psPSphereTransformApply()", 0, false}, 48 {testSphereTransformApply2, 820, "psPSphereTransformApply()", 0, false}, 49 {testSphereTransformICRSToEcliptic, 0000, "psSphereTransformICRSToEcliptic()", 0, false}, 50 50 {test6, 0000, "psSphereTransformEclipticToICRS()", 0, false}, 51 51 {test7, 0000, "psSphereTransformICRSToGalatic()", 0, false}, … … 583 583 } 584 584 585 psS32 test5( void ) 586 { 587 psS32 testStatus = 0; 588 589 // XXX: This test code is simply a copy of the original source code. 590 psTime* now = psTimeGetTime(PS_TIME_UTC); 591 struct tm *tm_time = psTimeToTM(now); 592 psF64 MJD = psTimeToMJD(now); 593 struct tm *tmTime = psTimeToTM(now); 594 psF64 year = (psF64)(1900 - MJD + tmTime->tm_year); 595 psF64 T = year / 100.0; 596 psF64 expectedAlphaP = 0.0; 597 psF64 expectedDeltaP = DEG_TO_RAD(23.0) + 598 SEC_TO_RAD(27.0) + 599 MIN_TO_RAD(8.0) - 600 (SEC_TO_RAD(46.845) * T) - 601 (SEC_TO_RAD(0.0059) * T * T) + 602 (SEC_TO_RAD(0.00181) * T * T * T); 603 expectedDeltaP*= -1.0; 604 psF64 expectedPhiP = 0.0; 605 psFree(tmTime); 606 607 psSphereTransform *myST = psSphereTransformICRSToEcliptic(now); 608 609 if (FLT_EPSILON < fabs(sin(expectedDeltaP) - myST->sinDeltaP)) { 610 printf("ERROR: myST->sinDeltaP is %f, should be %f\n", myST->sinDeltaP, sin(expectedDeltaP)); 611 testStatus = 1; 612 } 613 614 if (FLT_EPSILON < fabs(cos(expectedDeltaP) - myST->cosDeltaP)) { 615 printf("ERROR: myST->cosDeltaP is %f, should be %f\n", myST->cosDeltaP, cos(expectedDeltaP)); 616 testStatus = 1; 617 } 618 619 if (FLT_EPSILON < fabs(expectedAlphaP - myST->alphaP)) { 620 printf("ERROR: myST->alphaP is %f, should be %f\n", myST->alphaP, expectedAlphaP); 621 testStatus = 3; 622 } 623 624 if (FLT_EPSILON < fabs(expectedPhiP - myST->phiP)) { 625 printf("ERROR: myST->phiP is %f, should be %f\n", myST->phiP, expectedPhiP); 626 testStatus = 4; 627 } 628 585 #define MJD_1900 15021.0 // Modified Julian Day 1/1/1900 00:00:00 586 #define MJD_2000 51544.0 // Modified Julian Day 1/1/2000 00:00:00 587 #define MJD_2100 88069.0 // Modified Julian Day 1/1/2100 00:00:00 588 589 // Thes values calculated from ADD-09 equations 590 #define EXPECT_COS_DELTAP_2000 0.917482 591 #define EXPECT_SIN_DELTAP_2000 -0.397777 592 #define EXPECT_COS_DELTAP_2100 0.917572 593 #define EXPECT_SIN_DELTAP_2100 -0.397567 594 595 #define ERROR_TOL 0.0001 596 597 psS32 testSphereTransformICRSToEcliptic( void ) 598 { 599 psF64 expectedPhiP = 0.0; 600 psF64 expectedAlphaP = 0.0; 601 psF64 expectedCosDeltaP = EXPECT_COS_DELTAP_2000; 602 psF64 expectedSinDeltaP = EXPECT_SIN_DELTAP_2000; 603 604 // Set test date time to 1/1/2000 00:00:00 605 psTime* testDateTime = psTimeFromMJD(MJD_2000); 606 607 // Invoke function to set psSphereTransforma objec 608 psSphereTransform *myST = psSphereTransformICRSToEcliptic(testDateTime); 609 610 // Verify expected values for the specified time 611 if (ERROR_TOL < fabs(expectedSinDeltaP - myST->sinDeltaP)) { 612 psError(PS_ERR_UNKNOWN,true,"myST->sinDeltaP is %f, should be %f", 613 myST->sinDeltaP, expectedSinDeltaP); 614 return 1; 615 } 616 if (ERROR_TOL < fabs(expectedCosDeltaP - myST->cosDeltaP)) { 617 psError(PS_ERR_UNKNOWN,true,"myST->cosDeltaP is %f, should be %f", 618 myST->cosDeltaP, expectedCosDeltaP); 619 return 2; 620 } 621 if (ERROR_TOL < fabs(expectedAlphaP - myST->alphaP)) { 622 psError(PS_ERR_UNKNOWN,true,"myST->alphaP is %f, should be %f", 623 myST->alphaP, expectedAlphaP); 624 return 3; 625 } 626 if (ERROR_TOL < fabs(expectedPhiP - myST->phiP)) { 627 psError(PS_ERR_UNKNOWN,true,"myST->phiP is %f, should be %f", 628 myST->phiP, expectedPhiP); 629 return 4; 630 } 629 631 psFree(myST); 630 psFree(tm_time); 631 psFree(now); 632 633 printf("-------------------------------------------------------------------\n"); 634 printf("Calling psSphereTransformICRSToEcliptic() with NULL input. Should generate error, return NULL.\n"); 632 psFree(testDateTime); 633 634 expectedCosDeltaP = EXPECT_COS_DELTAP_2100; 635 expectedSinDeltaP = EXPECT_SIN_DELTAP_2100; 636 637 // Set test date time to 1/1/2100 00:00:00 638 testDateTime = psTimeFromMJD(MJD_2100); 639 640 // Invoke function to set psSphereTransforma objec 641 myST = psSphereTransformICRSToEcliptic(testDateTime); 642 643 // Verify expected values for the specified time 644 if (ERROR_TOL < fabs(expectedSinDeltaP - myST->sinDeltaP)) { 645 psError(PS_ERR_UNKNOWN,true,"myST->sinDeltaP is %f, should be %f", 646 myST->sinDeltaP, expectedSinDeltaP); 647 return 5; 648 } 649 if (ERROR_TOL < fabs(expectedCosDeltaP - myST->cosDeltaP)) { 650 psError(PS_ERR_UNKNOWN,true,"myST->cosDeltaP is %f, should be %f", 651 myST->cosDeltaP, expectedCosDeltaP); 652 return 6; 653 } 654 if (ERROR_TOL < fabs(expectedAlphaP - myST->alphaP)) { 655 psError(PS_ERR_UNKNOWN,true,"myST->alphaP is %f, should be %f", 656 myST->alphaP, expectedAlphaP); 657 return 7; 658 } 659 if (ERROR_TOL < fabs(expectedPhiP - myST->phiP)) { 660 psError(PS_ERR_UNKNOWN,true,"myST->phiP is %f, should be %f", 661 myST->phiP, expectedPhiP); 662 return 8; 663 } 664 psFree(myST); 665 psFree(testDateTime); 666 667 // Verify if argument psTime is NULL, function returns NULL and error message generated 668 psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message"); 635 669 myST = psSphereTransformICRSToEcliptic(NULL); 636 670 if (myST != NULL) { 637 printf("TEST ERROR: psSphereTransformApply() did not return NULL.\n"); 638 testStatus = false; 639 myST = NULL; 640 } 641 642 return(testStatus); 671 psError(PS_ERR_UNKNOWN,true,"psSphereTransformICRSToEcliptic() did not return NULL."); 672 return 9; 673 } 674 675 // Verify if argument psTime is less than 1900, function return NULL and error msg generated 676 psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message"); 677 testDateTime = psTimeFromMJD(MJD_1900 - 1.0); 678 myST = psSphereTransformICRSToEcliptic(testDateTime); 679 if (myST != NULL) { 680 psError(PS_ERR_UNKNOWN,true,"psSphereTransformICRSToEcliptic() did not return NULL."); 681 return 10; 682 } 683 psFree(testDateTime); 684 685 return 0; 643 686 } 644 687 -
trunk/psLib/test/astronomy/verified/tst_psCoord.stderr
r3293 r3324 104 104 \**********************************************************************************/ 105 105 106 <DATE><TIME>|<HOST>|I|testSphereTransformICRSToEcliptic 107 Following should generate an error message 106 108 <DATE><TIME>|<HOST>|E|psSphereTransformICRSToEcliptic (FILE:LINENO) 107 109 Unallowable operation: time is NULL. 110 <DATE><TIME>|<HOST>|I|testSphereTransformICRSToEcliptic 111 Following should generate an error message 112 <DATE><TIME>|<HOST>|E|psSphereTransformICRSToEcliptic (FILE:LINENO) 113 Specified time is less than 1900. 108 114 109 115 ---> TESTPOINT PASSED (psCoord{psSphereTransformICRSToEcliptic()} | tst_psCoord.c) -
trunk/psLib/test/astronomy/verified/tst_psCoord.stdout
r3293 r3324 32 32 ------------------------------------------------------------------- 33 33 ------------------------------------------------------------------- 34 Calling psSphereTransformICRSToEcliptic() with NULL input. Should generate error, return NULL.35 -------------------------------------------------------------------36 34 Calling psSphereTransformEclipticToICRS() with NULL input. Should generate error, return NULL. 37 35 -------------------------------------------------------------------
Note:
See TracChangeset
for help on using the changeset viewer.
