2019-10-24 10:44:21 +08:00
|
|
|
package basic
|
|
|
|
|
|
|
|
|
|
import (
|
2024-01-15 17:05:18 +08:00
|
|
|
"math"
|
2019-10-24 10:44:21 +08:00
|
|
|
"testing"
|
|
|
|
|
)
|
|
|
|
|
|
2026-05-01 22:38:44 +08:00
|
|
|
func TestNutationRegression(t *testing.T) {
|
2024-01-15 17:05:18 +08:00
|
|
|
jde := 2452982.9872345612
|
|
|
|
|
|
2026-05-01 22:38:44 +08:00
|
|
|
if got := Nutation2000Bi(jde); math.Abs(got-(-0.003747344689665249)) > 1e-9 {
|
|
|
|
|
t.Fatalf("Nutation2000Bi mismatch: got %.18f", got)
|
|
|
|
|
}
|
|
|
|
|
if got := Nutation1980s(jde); math.Abs(got-0.001511763511795865) > 1e-9 {
|
|
|
|
|
t.Fatalf("Nutation1980s mismatch: got %.18f", got)
|
2024-01-15 17:05:18 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-04 14:24:44 +08:00
|
|
|
func Benchmark_SunRise(b *testing.B) {
|
|
|
|
|
jde := GetNowJDE()
|
|
|
|
|
for i := 0; i < b.N; i++ {
|
2026-05-01 22:38:44 +08:00
|
|
|
_, _ = GetSunRiseTime(jde, 115, 32, 8, 0, 10)
|
2022-01-04 14:24:44 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func Benchmark_SunLo(b *testing.B) {
|
|
|
|
|
jde := GetNowJDE()
|
|
|
|
|
for i := 0; i < b.N; i++ {
|
2022-05-12 15:55:48 +08:00
|
|
|
HSunApparentLo(jde)
|
2022-01-04 14:24:44 +08:00
|
|
|
}
|
2024-01-16 11:30:53 +08:00
|
|
|
}
|