Files
digital-psychology/apps/api/internal/star/ephemeris/ephemeris_test.go
T
jackyu66gitandCursor bd22d9dddd feat: P1 合盘/星座/问答与测测完整设计包及模拟器取证工具
落地 synastry/star/ask API 与 H5 页面,补齐 cece-frontend-re complete-design 证据文档,并加入 Android 模拟器截图抓取脚本。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-03 11:37:53 +08:00

45 lines
843 B
Go

package ephemeris
import (
"testing"
"time"
)
func TestSunMay1990(t *testing.T) {
if !Ready() {
t.Fatal("ephemeris not ready")
}
// 1990-05-12 10:30 CST = 02:30 UTC
utc := time.Date(1990, 5, 12, 2, 30, 0, 0, time.UTC)
jd := JulianDayUT(utc)
lon, err := PlanetLon(jd, BodySun)
if err != nil {
t.Fatal(err)
}
// ~51° Taurus
if lon < 48 || lon > 55 {
t.Fatalf("sun lon=%.2f want ~51°", lon)
}
asc, err := Ascendant(jd, 31.23, 121.47)
if err != nil {
t.Fatal(err)
}
if asc < 0 || asc >= 360 {
t.Fatalf("bad asc %.2f", asc)
}
if Backend() == "" {
t.Fatal("empty backend")
}
}
func TestAllPlanetLons(t *testing.T) {
jd := JulianDayUT(time.Date(2000, 1, 1, 12, 0, 0, 0, time.UTC))
m, err := AllPlanetLons(jd)
if err != nil {
t.Fatal(err)
}
if len(m) != len(PlanetOrder) {
t.Fatalf("got %d", len(m))
}
}