IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 3333


Ignore:
Timestamp:
Feb 25, 2005, 12:27:38 PM (21 years ago)
Author:
evanalst
Message:

Update for test cases for psSphereTransform to and from ICRS/Galactic.

Location:
trunk/psLib/test/astronomy
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/test/astronomy/tst_psCoord.c

    r3331 r3333  
    66*  @author GLG, MHPCC
    77*
    8 *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
    9 *  @date $Date: 2005-02-25 20:50:35 $
     8*  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
     9*  @date $Date: 2005-02-25 22:27:37 $
    1010*
    1111*  XXX: Must test psSpherePrecess.
     
    3131static psS32 testSphereTransformICRSToEcliptic( void );
    3232static psS32 testSphereTransformEclipticToICRS( void );
    33 static psS32 test7( void );
    34 static psS32 test8( void );
     33static psS32 testSphereTransformICRSToGalactic( void );
     34static psS32 testSphereTransformGalacticToICRS( void );
    3535//static psS32 test20( void );
    3636//static psS32 test21( void );
     
    4949                              {testSphereTransformICRSToEcliptic, 821, "psSphereTransformICRSToEcliptic()", 0, false},
    5050                              {testSphereTransformEclipticToICRS, 822, "psSphereTransformEclipticToICRS()", 0, false},
    51                               {test7, 0000, "psSphereTransformICRSToGalatic()", 0, false},
    52                               {test8, 0000, "psSphereTransformGalaticToICRS()", 0, false},
     51                              {testSphereTransformICRSToGalactic, 824, "psSphereTransformICRSToGalactic()", 0, false},
     52                              {testSphereTransformGalacticToICRS, 823, "psSphereTransformGalacticToICRS()", 0, false},
    5353                              //         {test20, 0000, "psProject()", 0, false},
    5454                              //         {test21, 0000, "psDeProject()", 0, false},
     
    778778}
    779779
    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
     785psS32 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
    809817    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
     827psS32 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
    842859    psFree(myST);
    843     return(testStatus);
     860
     861    return 0;
    844862}
    845863
  • trunk/psLib/test/astronomy/verified/tst_psCoord.stderr

    r3331 r3333  
    134134/***************************** TESTPOINT ******************************************\
    135135*             TestFile: tst_psCoord.c                                              *
    136 *            TestPoint: psCoord{psSphereTransformICRSToGalatic()}                  *
     136*            TestPoint: psCoord{psSphereTransformICRSToGalactic()}                 *
    137137*             TestType: Positive                                                   *
    138138\**********************************************************************************/
    139139
    140140
    141 ---> TESTPOINT PASSED (psCoord{psSphereTransformICRSToGalatic()} | tst_psCoord.c)
     141---> TESTPOINT PASSED (psCoord{psSphereTransformICRSToGalactic()} | tst_psCoord.c)
    142142
    143143/***************************** TESTPOINT ******************************************\
    144144*             TestFile: tst_psCoord.c                                              *
    145 *            TestPoint: psCoord{psSphereTransformGalaticToICRS()}                  *
     145*            TestPoint: psCoord{psSphereTransformGalacticToICRS()}                 *
    146146*             TestType: Positive                                                   *
    147147\**********************************************************************************/
    148148
    149149
    150 ---> TESTPOINT PASSED (psCoord{psSphereTransformGalaticToICRS()} | tst_psCoord.c)
     150---> TESTPOINT PASSED (psCoord{psSphereTransformGalacticToICRS()} | tst_psCoord.c)
    151151
    152152/***************************** TESTPOINT ******************************************\
Note: See TracChangeset for help on using the changeset viewer.