astro/venus/transit_test.go
starainrt bec7b8a0d8
feat: 增强日月食搜索、沙罗周期与内行星凌日
- 使用压缩表加速查找日月食沙罗周期信息
- 优化日月食搜索跳步,减少非食季朔望月扫描
- 新增本地日全食、日环食、月全食搜索接口,返回 ok 区分未找到结果
- 新增水星、金星地心凌日查询及测试
2026-05-03 19:00:08 +08:00

24 lines
652 B
Go

package venus
import (
"testing"
"time"
)
func TestTransitWrappers(t *testing.T) {
loc := time.FixedZone("CST", 8*3600)
info := NextTransit(time.Date(2012, 1, 1, 0, 0, 0, 0, loc))
if !info.Valid {
t.Fatal("expected valid transit")
}
if info.Greatest.Location() != loc {
t.Fatalf("timezone mismatch: got %v want %v", info.Greatest.Location(), loc)
}
if info.Greatest.Year() != 2012 || info.Greatest.Month() != time.June || info.Greatest.Day() != 6 {
t.Fatalf("unexpected greatest time: %s", info.Greatest)
}
if !info.HasInternal || info.Duration <= 0 || info.InternalDuration <= 0 {
t.Fatalf("unexpected durations: %+v", info)
}
}