Exemple #1
0
// Lacking a worked example from the text, test using meeus/moonposition.
func TestPerigeeParallax(t *testing.T) {
	got := apsis.PerigeeParallax(1997.93)
	_, _, d := moonposition.Position(apsis.Perigee(1997.93))
	want := moonposition.Parallax(d)
	Δ := math.Abs((got - want).Sec())
	// for this case anyway it's within a tenth of an arc second
	if Δ > .1 {
		t.Fatal("got", got, "want (about)", want)
	}
}
Exemple #2
0
// Test cases from p. 361.
func TestPerigee(t *testing.T) {
	for _, c := range []struct {
		y, m  int
		d, dy float64
	}{
		{1997, 12, 9 + 16.9/24, 1997.93},
		{1998, 1, 3 + 8.5/24, 1998.01},
		{1990, 12, 2 + 10.8/24, 1990.92},
		{1990, 12, 30 + 23.8/24, 1991},
	} {
		ref := julian.CalendarGregorianToJD(c.y, c.m, c.d)
		j := apsis.Perigee(c.dy)
		if math.Abs(j-ref) > .1 {
			t.Fatal("got", j, "expected", ref)
		}
	}
}