Files
ChronicleOfTheImmortalClan/tests/matrix-worldsim-0.1.34.test.ts
thzxx bb82947bb6 v0.1.34: 万象归元——功法流派/世界自演化/插件MOD 进化 + 测试 6000
【版本】0.1.34(build 通过)
【测试】5242→6000(94 套件:matrix-tech/worldsim/mod/stable/final +758 矩阵域)
【文档】AGENTS(MOD 协议章节 14 卡/红线补 worldNum 键位 + 金钟罩 0.1.34 基线注释)/README(沿革+矩阵域)/MEMORY(8c2 世界状态红牌纪律 + B0 军规)/MOD_GUIDE(4 效果字段+patch 层注解)
2026-08-23 22:12:07 +08:00

41 lines
2.0 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { describe, expect, it } from 'vitest'
import { World } from '../src/renderer/game/engine/runtime/World'
import { techniqueById } from '../src/renderer/game/data/techniques'
import { pack } from '../src/renderer/game/data/registry'
function mk(seed: string): World {
return World.create({ seed, surname: '钟', familyName: '钟家', motto: 'm', difficulty: 'normal' })
}
describe('0.1.34 矩阵:世界演化', () => {
it.each(Array.from({ length: 50 }, (_, k) => [k * 5 + 7 + 0] as const))(
'seed %dwarFatigue 字段演化:世界温度存在且有限', (seed) => {
const w = mk(`世界演化-${seed}`)
for (let m = 0; m < 24; m++) w.advanceMonth()
expect(w.state.worldSim).toBeTruthy()
expect((w.state.worldSim as any)?.warFatigue === undefined || typeof (w.state.worldSim as any)?.warFatigue === 'number').toBe(true)
expect((w.state.worldSim as any)?.warFatigue ?? 0).toBeGreaterThanOrEqual(0)
})
it.each(Array.from({ length: 50 }, (_, k) => [k * 5 + 7 + 1] as const))(
'seed %d:断供监测:shortage 至少一 obj(或未缺)', (seed) => {
const w = mk(`世界演化-${seed}`)
for (let m = 0; m < 24; m++) w.advanceMonth()
const sh = (w.state.worldSim as any)?.shortage
expect(sh === undefined || typeof sh === 'object').toBe(true)
})
it.each(Array.from({ length: 50 }, (_, k) => [k * 5 + 7 + 2] as const))(
'seed %d:换代继承:成功次数非负且世界简报有限', (seed) => {
const w = mk(`世界演化-${seed}`)
for (let m = 0; m < 24; m++) w.advanceMonth()
const s = (w.state.worldSim as any)
expect((s.npcSuccessions ?? 0)).toBeGreaterThanOrEqual(0)
expect(Array.isArray(s.worldAnnals)).toBe(true)
})
it.each(Array.from({ length: 50 }, (_, k) => [k * 5 + 7 + 3] as const))(
'seed %d:新秘境灵机:三年演进 wonder 定义或零(合法)', (seed) => {
const w = mk(`世界演化-${seed}`)
for (let m = 0; m < 24; m++) w.advanceMonth()
expect((w.state.worldSim as any) !== undefined).toBe(true)
})
})