23#include <gtest/gtest.h>
25#include <libnova/nutation.h>
28static constexpr double JD_TEST = 2459019.833333;
29static constexpr double RA_J2000_H = 20.69053168;
30static constexpr double DEC_J2000_DEG = 45.28033881;
31static constexpr double RA_TRUTH_H = 20.70237028;
32static constexpr double DEC_TRUTH_DEG = 45.35036333;
40TEST(LibnovaNutation, DecCorrectionSign)
42 ln_equ_posn pos_before = { RA_J2000_H * 15.0, DEC_J2000_DEG };
43 ln_equ_posn pos_after = pos_before;
47 double delta_dec_arcsec = (pos_after.dec - pos_before.dec) * 3600.0;
49 GTEST_LOG_(INFO) <<
"Nutation Dec correction: " << delta_dec_arcsec <<
"\"";
50 GTEST_LOG_(INFO) <<
"Nutation RA correction: " << (pos_after.ra - pos_before.ra) * 3600.0 <<
"\"";
55 EXPECT_LT(delta_dec_arcsec, 0.0)
56 <<
"Dec nutation correction is positive (" << delta_dec_arcsec
57 <<
"\") — expected negative for Deneb at this epoch. "
58 "Likely DEG_TO_RAD macro bug in ln_get_equ_nut.";
65TEST(LibnovaNutation, J2000toObservedAccuracy)
72 double cos_dec = std::cos(DEC_TRUTH_DEG *
M_PI / 180.0);
73 double err_ra = std::abs(jnow.
rightascension - RA_TRUTH_H) * 15.0 * 3600.0 * cos_dec;
74 double err_dec = std::abs(jnow.
declination - DEC_TRUTH_DEG) * 3600.0;
75 double err_total = std::hypot(err_ra, err_dec);
77 GTEST_LOG_(INFO) <<
"Deneb J2000toObserved: ra=" << jnow.
rightascension
79 GTEST_LOG_(INFO) <<
"Error vs IMCCE: RA=" << err_ra <<
"\" Dec=" << err_dec
80 <<
"\" total=" << err_total <<
"\"";
82 EXPECT_LT(err_total, 1.0)
83 <<
"J2000toObserved error=" << err_total
84 <<
"\" exceeds 1\" vs IMCCE truth — likely DEG_TO_RAD macro bug";
87int main(
int argc,
char **argv)
89 ::testing::InitGoogleTest(&argc, argv);
90 return RUN_ALL_TESTS();
void ln_get_equ_nut(ln_equ_posn *posn, double jd, bool reverse)
apply or remove nutation
void J2000toObserved(IEquatorialCoordinates *J2000pos, double jd, IEquatorialCoordinates *observed)
*J2000toObserved converts catalogue to observed
TEST(LibnovaNutation, DecCorrectionSign)