public void TestCoordinates() { CalendarAstronomer astro = new CalendarAstronomer(); IBM.ICU.Impl.CalendarAstronomer.Equatorial result = astro.EclipticToEquatorial(139.686111d * PI / 180.0d, 4.875278d * PI / 180.0d); Logln("result is " + result + "; " + result.ToHmsString()); }
public void TestLunarPosition() { IBM.ICU.Util.GregorianCalendar gc = new IBM.ICU.Util.GregorianCalendar(new SimpleTimeZone(0, "UTC")); CalendarAstronomer astro = new CalendarAstronomer(); double[][] tests = { new double[] { 1979, 2, 26, 16, 0x0, -0.3778379118188744d, -0.1399698825594198d } }; Logln(""); for (int i = 0; i < tests.Length; i++) { gc.Clear(); gc.Set((int)tests[i][0], (int)tests[i][1] - 1, (int)tests[i][2], (int)tests[i][3], (int)tests[i][4]); astro.SetDate(gc.GetTime()); IBM.ICU.Impl.CalendarAstronomer.Equatorial result = astro.GetMoonPosition(); if (result.ascension != tests[i][5]) { if ((float)result.ascension == (float)tests[i][5]) { Logln("result.ascension(" + result.ascension + ") != tests[i][5](" + tests[i][5] + ") in double for test " + i); } else { Errln("FAIL: result.ascension(" + result.ascension + ") != tests[i][5](" + tests[i][5] + ") for test " + i); } } if (result.declination != tests[i][6]) { if ((float)result.declination == (float)tests[i][6]) { Logln("result.declination(" + result.declination + ") != tests[i][6](" + tests[i][6] + ") in double for test " + i); } else { Errln("FAIL: result.declination(" + result.declination + ") != tests[i][6](" + tests[i][6] + ") for test " + i); } } } }
public void TestSolarLongitude() { IBM.ICU.Util.GregorianCalendar gc = new IBM.ICU.Util.GregorianCalendar(new SimpleTimeZone(0, "UTC")); CalendarAstronomer astro = new CalendarAstronomer(); double[][] tests = { new double[] { 1980, 7, 27, 0x0, 0x0, 2.166442986535465d, 2.2070499713207730d, 0.3355704075759270d }, new double[] { 1988, 7, 27, 0x0, 0x0, 2.167484927693959d, 2.2081183335606176d, 0.3353093444275315d } }; Logln(""); for (int i = 0; i < tests.Length; i++) { gc.Clear(); gc.Set((int)tests[i][0], (int)tests[i][1] - 1, (int)tests[i][2], (int)tests[i][3], (int)tests[i][4]); astro.SetDate(gc.GetTime()); double longitude = astro.GetSunLongitude(); if (longitude != tests[i][5]) { if ((float)longitude == (float)tests[i][5]) { Logln("longitude(" + longitude + ") != tests[i][5](" + tests[i][5] + ") in double for test " + i); } else { Errln("FAIL: longitude(" + longitude + ") != tests[i][5](" + tests[i][5] + ") for test " + i); } } IBM.ICU.Impl.CalendarAstronomer.Equatorial result = astro.GetSunPosition(); if (result.ascension != tests[i][6]) { if ((float)result.ascension == (float)tests[i][6]) { Logln("result.ascension(" + result.ascension + ") != tests[i][6](" + tests[i][6] + ") in double for test " + i); } else { Errln("FAIL: result.ascension(" + result.ascension + ") != tests[i][6](" + tests[i][6] + ") for test " + i); } } if (result.declination != tests[i][7]) { if ((float)result.declination == (float)tests[i][7]) { Logln("result.declination(" + result.declination + ") != tests[i][7](" + tests[i][7] + ") in double for test " + i); } else { Errln("FAIL: result.declination(" + result.declination + ") != tests[i][7](" + tests[i][7] + ") for test " + i); } } } }