每账号仅一条 self(migration 40902);合盘只选 TA;账号昵称可改;首页穿衣/颜色/养生贴士。 Co-authored-by: Cursor <cursoragent@cursor.com>
30 lines
848 B
Go
30 lines
848 B
Go
package yijing
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
func TestSeedStableSameInputs(t *testing.T) {
|
|
bt := "10:30"
|
|
now := time.Date(2026, 8, 11, 19, 0, 0, 0, time.FixedZone("CST", 8*3600))
|
|
a := Seed("1990-05-12", &bt, now)
|
|
b := Seed("1990-05-12", &bt, now)
|
|
if a.GuaIndex != b.GuaIndex || a.GuaName != b.GuaName || a.Line != b.Line {
|
|
t.Fatalf("expected stable seed, got %+v vs %+v", a, b)
|
|
}
|
|
if a.GuaIndex < 1 || a.GuaIndex > 64 {
|
|
t.Fatalf("gua out of range: %d", a.GuaIndex)
|
|
}
|
|
}
|
|
|
|
func TestSeedChangesWithHour(t *testing.T) {
|
|
now1 := time.Date(2026, 8, 11, 9, 0, 0, 0, time.FixedZone("CST", 8*3600))
|
|
now2 := time.Date(2026, 8, 11, 18, 0, 0, 0, time.FixedZone("CST", 8*3600))
|
|
a := Seed("1990-05-12", nil, now1)
|
|
b := Seed("1990-05-12", nil, now2)
|
|
if a.DayPart == b.DayPart {
|
|
t.Fatalf("expected different day parts, both %s", a.DayPart)
|
|
}
|
|
}
|