Files
astro/geojson/solar_eclipse_29020726_regression_test.go
T
b612 2bf8478639 feat: 完善日月食与月掩几何链路并扩展历法接口
- 新增日月食中心带、偏食带、阴影足迹、等时线、食分线及升落边界计算,支持极区与混合食拓扑
- 新增日食单时刻阴影求解器、站心状态查询、批量采样和 ΔT 覆盖接口
- 重构恒星与行星月掩路径,补充有限盘面接触、站心修正、掩带宽度、极区投影及升落边界
- 扩展 SVG 与 GeoJSON 输出,支持详细面板、全球/极区/地球投影、边界闭合、时间标记和拓扑签名
- 扩展日月食候选搜索、局地搜索、沙罗序列预计算与范围外推,补充系列锚点和成员一致性校验
- 补齐古历纪年、儒略历独有闰日、多公历候选、历法改革跨日及精确日期运算接口
- 优化 ΔT、章动、恒星时、月球地平线、事件根搜索和本地星历缓存,降低重复计算开销并提升边界稳定
2026-09-17 12:27:40 +08:00

50 lines
1.9 KiB
Go

package geojson_test
import (
"testing"
"time"
"b612.me/astro/eclipse"
"b612.me/astro/geojson"
)
func TestMarshalSolarEclipse29020726DoesNotFillNighttimeCanada(t *testing.T) {
date := time.Date(2902, time.July, 26, 0, 0, 0, 0, time.UTC)
partial, ok := eclipse.SolarEclipsePartialFootprints(date, eclipse.SolarEclipsePartialFootprintOptions{
Step: 2 * time.Minute, BoundaryPoints: 96, CentralShadowStep: 2 * time.Minute,
MagnitudeValues: []float64{0.2, 0.4, 0.6, 0.8, 1.0},
})
if !ok {
t.Fatal("expected solar eclipse footprints")
}
data, err := geojson.MarshalSolarEclipse(partial, nil)
if err != nil {
t.Fatalf("MarshalSolarEclipse: %v", err)
}
band := featureWithRole(t, decodeCollection(t, data), "partial-band")
if band.Geometry.Type != "MultiPolygon" {
t.Fatalf("partial-band geometry=%q, want MultiPolygon", band.Geometry.Type)
}
for _, site := range []struct {
name string
longitude float64
latitude float64
wantInside bool
}{
{name: "Edmonton", longitude: -113.4909, latitude: 53.5461},
{name: "Churchill", longitude: -94.1650, latitude: 58.7684},
{name: "Iqaluit", longitude: -68.5170, latitude: 63.7467},
{name: "Resolute", longitude: -94.8297, latitude: 74.6973, wantInside: true},
{name: "Alert", longitude: -62.3481, latitude: 82.5018, wantInside: true},
{name: "Bering east of envelope", longitude: 179, latitude: 65},
{name: "Bering inside excluded pocket", longitude: 175, latitude: 65},
{name: "Bering west of envelope", longitude: 170, latitude: 65, wantInside: true},
{name: "Bering west world", longitude: -179, latitude: 65},
{name: "Arctic east world", longitude: 179.9, latitude: 80, wantInside: true},
} {
if got := geometryContainsPoint(t, band.Geometry, site.longitude, site.latitude); got != site.wantInside {
t.Errorf("partial-band contains %s=%v, want %v", site.name, got, site.wantInside)
}
}
}