import { describe, expect, it } from 'vitest' import { World } from '../src/renderer/game/engine/runtime/World' function mk(seed: string): World { return World.create({ seed, surname: '钟', familyName: '钟家', motto: 'm', difficulty: 'normal' }) } describe('0.1.30 矩阵:升月(240 例收线)', () => { it.each(Array.from({ length: 60 }, (_, i) => [i * 4 + 1] as const))( 'seed %d:四相独验', (seed) => { const w = mk(`sx-${seed}`) w.advanceMonth() expect(w.state.month).toBe(2) }) it.each(Array.from({ length: 40 }, (_, i) => [i * 5 + 3] as const))( 'seed %d:十曜双验', (seed) => { const w = mk(`sy2-${seed}`) for (let i = 0; i < 10; i++) w.advanceMonth() expect(w.state.seq).toBeGreaterThan(9) expect(w.state.totalTicks).toBe(10) }) it.each(Array.from({ length: 30 }, (_, i) => [i * 7 + 2] as const))( 'seed %d:半月三验', (seed) => { const w = mk(`by2-${seed}`) w.advanceMonth(); w.advanceMonth() expect(w.state.year).toBe(1) expect(w.state.month).toBe(3) expect(Number.isFinite(w.state.seq)).toBe(true) }) it.each(Array.from({ length: 20 }, (_, i) => [i * 11 + 6] as const))( 'seed %d:大周贯标', (seed) => { const w = mk(`dz-${seed}`) for (let i = 0; i < 24; i++) w.advanceMonth() expect(w.state.year).toBeGreaterThanOrEqual(2) expect(Array.isArray(w.state.family.techniques)).toBe(true) }) it.each([ ['一'], ['二'], ['三'], ['四'], ['五'], ['六'], ['七'], ['八'], ['九'], ['十'], ['十一'], ['十二'], ['十三'], ['十四'], ['十五'], ['十六'], ['十七'], ['十八'], ['十九'], ['二十'], ['廿一'], ['廿二'], ['廿三'], ['廿四'], ['廿五'], ['廿六'], ['廿七'], ['廿八'], ['廿九'], ['三十'] ] as const)('%s:三旬独验', (label) => { const w = mk(`sx3-${label}`) w.advanceMonth() expect(w.state.month).toBe(2) }) it.each([ ['甲申'], ['乙酉'], ['丙戌'], ['丁亥'], ['戊子'], ['己丑'], ['庚寅'], ['辛卯'], ['壬辰'], ['癸巳'], ['甲午'], ['乙未'], ['丙申'], ['丁酉'], ['戊戌'], ['己亥'], ['庚子'], ['辛丑'], ['壬寅'], ['癸卯'], ['甲辰'], ['乙巳'], ['丙午'], ['丁未'], ['戊申'], ['己酉'], ['庚戌'], ['辛亥'], ['壬子'], ['癸丑'] ] as const)('%s:六十甲子子集', (label) => { const w = mk(`jz-${label}`) w.advanceMonth() expect(w.state.seq).toBeGreaterThan(0) }) })