astro/mercury/mercury_test.go
starainrt 4302981518
- fix: Correct sun.TrueBo calculation, now using basic.HSunTrueBo for correct solar latitude
- fix: Rename GetSunDownTime to GetSunSetTime in basic/sun.go and update related calls/outputs
- fix: Update test cases to use new method and error constant names

- improve: Rename all DownTime/Down functions to SetTime/Set for consistency
- improve: Standardize ERR_XXX_NEVER_DOWN error constants to ERR_XXX_NEVER_SET, with ERR_XXX_NEVER_DOWN kept as compatibility alias
- improve: More standard naming for interfaces and errors to improve maintainability and readability
2025-09-08 10:37:46 +08:00

27 lines
564 B
Go

package mercury
import (
"fmt"
"testing"
"time"
)
func TestMercury(t *testing.T) {
tz := time.FixedZone("CST", 8*3600)
date := time.Date(2022, 01, 20, 00, 00, 00, 00, tz)
if NextConjunction(date).Unix() != 1642933683 {
t.Fatal(NextConjunction(date).Unix())
}
if CulminationTime(date, 115).Unix() != 1642654651 {
t.Fatal(CulminationTime(date, 115).Unix())
}
date, err := (RiseTime(date, 115, 40, 0, false))
if err != nil {
t.Fatal(err)
}
if date.Unix() != 1642636481 {
t.Fatal(date.Unix())
}
fmt.Println(SetTime(date, 115, 40, 0, false))
}