-
Notifications
You must be signed in to change notification settings - Fork 0
/
nutation_test.go
46 lines (40 loc) · 1.14 KB
/
nutation_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package goastro
import (
"testing"
"math"
)
func arcSecondDifference(a, b Angle) float64 {
return math.Abs((a - b).ArcSeconds())
}
func TestLongitudeNutation(t *testing.T) {
date := Date{1987, 4, 10}
want := ArcSeconds(-3.788)
got := LongitudeNutation(TD{date, 0})
if arcSecondDifference(want, got) > 0.01 {
t.Errorf("LongitudeNutation(%v) == %v\", want %v\"", date, got, want)
}
}
func TestObliquityNutation(t *testing.T) {
date := Date{1987, 4, 10}
want := ArcSeconds(9.443)
got := ObliquityNutation(TD{date, 0})
if arcSecondDifference(want, got) > 0.01 {
t.Errorf("ObliquityNutation(%v) == %v\", want %v\"", date, got, want)
}
}
func TestMeanObliquity(t *testing.T) {
date := Date{1987, 4, 10}
want := Degrees(23 + ms(26, 27.407))
got := MeanObliquity(TD{date, 0})
if arcSecondDifference(want, got) > 0.001 {
t.Errorf("MeanObliquity(%v) == %v\", want %v\"", date, got, want)
}
}
func TestTrueObliquity(t *testing.T) {
date := Date{1987, 4, 10}
want := Degrees(23 + ms(26, 36.850))
got := TrueObliquity(TD{date, 0})
if arcSecondDifference(want, got) > 0.01 {
t.Errorf("TrueObliquity(%v) == %v, want %v", date, got, want)
}
}