diff options
| author | Somhairle H. Marisol <[email protected]> | 2026-09-22 08:21:32 +0800 |
|---|---|---|
| committer | Somhairle H. Marisol <[email protected]> | 2026-09-22 08:21:32 +0800 |
| commit | 7dfd58b71568e28fc591b55765635f3f32ad01e5 (patch) | |
| tree | 2d90c06a7862935858d3435805b3af186bbd310b /src/LivingVillage.Kernel.Tests/DeterminismTests.fs | |
| parent | fa20cc35eab8b597707bebc0ff8ef0e2ccb58d47 (diff) | |
| parent | 91d3e7dc95981f92f56a82c19334b5c26d52c226 (diff) | |
| download | living-village-7dfd58b71568e28fc591b55765635f3f32ad01e5.tar.gz | |
merge: P23 512x384 扩程(writer hash 保留)
Diffstat (limited to 'src/LivingVillage.Kernel.Tests/DeterminismTests.fs')
| -rw-r--r-- | src/LivingVillage.Kernel.Tests/DeterminismTests.fs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/LivingVillage.Kernel.Tests/DeterminismTests.fs b/src/LivingVillage.Kernel.Tests/DeterminismTests.fs index 52cae89..c4b4154 100644 --- a/src/LivingVillage.Kernel.Tests/DeterminismTests.fs +++ b/src/LivingVillage.Kernel.Tests/DeterminismTests.fs @@ -113,6 +113,30 @@ type DeterminismTests () = checkedTicks <- checkedTicks + 1 Assert.IsTrue(120001 = checkedTicks) + /// P23:512x384 参数化边界下,avatar 与全部 NPC 在长跑中仍留在 [0, max] 且数值有限。 + [<TestMethod>] + member _.LargeMapBoundsClampAvatarAndNpcs () = + Sim.configureBounds 512 384 + try + let trace = DriverHarness.run 4242UL 20000L + let maxX = float32 (Sim.mapWidthTiles * Sim.tilePixels - Sim.tilePixels) + let maxY = float32 (Sim.mapHeightTiles * Sim.tilePixels - Sim.tilePixels) + Assert.IsTrue(maxX > 64.0f * float32 Sim.tilePixels, "512 map must extend past legacy width") + for w in trace do + let p = w.Avatar.Pos + if Single.IsNaN p.X || Single.IsNaN p.Y then Assert.Fail($"NaN avatar at tick {w.Tick}") + if p.X < 0.0f || p.X > maxX then Assert.Fail($"avatar X out of bounds at tick {w.Tick}: {p.X}") + if p.Y < 0.0f || p.Y > maxY then Assert.Fail($"avatar Y out of bounds at tick {w.Tick}: {p.Y}") + for npc in w.Npcs do + if Single.IsNaN npc.Pos.X || Single.IsNaN npc.Pos.Y then + Assert.Fail($"NaN npc {npc.Id} at tick {w.Tick}") + if npc.Pos.X < 0.0f || npc.Pos.X > maxX then + Assert.Fail($"npc {npc.Id} X out of bounds at tick {w.Tick}: {npc.Pos.X}") + if npc.Pos.Y < 0.0f || npc.Pos.Y > maxY then + Assert.Fail($"npc {npc.Id} Y out of bounds at tick {w.Tick}: {npc.Pos.Y}") + finally + Sim.configureBounds 64 48 + [<TestMethod>] member _.SplitMix64MatchesKnownVectors () = let expected : uint64 list = |
