Files
astro/basic/mercury_retrograde_optimization_test.go
T
b612 9ee2163cc7 feat: 新增月掩与日月食地理绘图并提升观测计算精度
- 新增月掩恒星和行星:支持搜索、掩甚点、全球掩带及固定地点轨迹计算
- 支持恒星星表坐标转换、有限盘面行星接触事件和月掩 SVG 输出
- 新增日月食及月掩全球投影图、时间标记和 GeoJSON 地理数据接口
- 扩展日食中心线、南北界及偏食足迹采样,支持极区投影
- 修正站心时角、月出月落、月球视半径、折射和恒星自行计算
- 优化内外行星事件搜索、边界选择、极端输入处理和计算稳定性
2026-08-06 12:00:56 +08:00

32 lines
1.1 KiB
Go

package basic
import (
"math"
"testing"
)
func TestMercuryRetrogradeFastPathKeepsTypedCandidateOrder(t *testing.T) {
// 这些查询覆盖一个普通古代周期和两个长间隔边界 / These queries cover a normal ancient cycle and two long-gap boundaries
//,类型化驻留搜索必须作为最终权威 / where the typed station search must remain the final authority.
for _, queryUT := range []float64{
1026548.810500779,
1644733.927538287,
1645082.416782375,
} {
queryTT := TD2UT(queryUT, true)
nextP2R := NextMercuryProgradeToRetrograde(queryTT)
nextR2P := NextMercuryRetrogradeToPrograde(queryTT)
wantNext := math.Min(nextP2R, nextR2P)
if got := NextMercuryRetrograde(queryTT); math.Abs(got-wantNext) > 1e-7 {
t.Fatalf("next aggregate mismatch at %.9f: got %.12f want %.12f", queryUT, got, wantNext)
}
lastP2R := LastMercuryProgradeToRetrograde(queryTT)
lastR2P := LastMercuryRetrogradeToPrograde(queryTT)
wantLast := math.Max(lastP2R, lastR2P)
if got := LastMercuryRetrograde(queryTT); math.Abs(got-wantLast) > 1e-7 {
t.Fatalf("last aggregate mismatch at %.9f: got %.12f want %.12f", queryUT, got, wantLast)
}
}
}