diff options
Diffstat (limited to 'src/LivingVillage.Desktop.Tests')
| -rw-r--r-- | src/LivingVillage.Desktop.Tests/PrototypeTests.fs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/LivingVillage.Desktop.Tests/PrototypeTests.fs b/src/LivingVillage.Desktop.Tests/PrototypeTests.fs index 5a40868..ece7b23 100644 --- a/src/LivingVillage.Desktop.Tests/PrototypeTests.fs +++ b/src/LivingVillage.Desktop.Tests/PrototypeTests.fs @@ -737,6 +737,28 @@ type PrototypeTests () = Assert.AreEqual<float32>(TitleScreen.entranceProgress 37L, TitleScreen.entranceProgress 37L) [<TestMethod>] + member _.ProceduralMapGeneratesByteIdenticalTerrainFromSameSeed () = + let first = ProceduralMap.generate (uint64 4242) + let second = ProceduralMap.generate (uint64 4242) + Assert.AreEqual<int>(first.Tiles.Length, second.Tiles.Length) + let snapshot = Array.copy first.Tiles + for i in 0 .. snapshot.Length - 1 do + Assert.AreEqual<int>(snapshot.[i], second.Tiles.[i], (sprintf "tile %d diverged" i)) + + // Different seed must produce different terrain (sanity). + let other = ProceduralMap.generate (uint64 777) + let differs = [0 .. snapshot.Length - 1] |> List.tryFind (fun i -> other.Tiles.[i] <> snapshot.[i]) + Assert.IsTrue(differs.IsSome, "different seed should carve different terrain") + + // Village core stays walkable: no water/peat inside the handcrafted core rect. + let coreBad = + [ for y in ProceduralMap.villageCoreMinY .. ProceduralMap.villageCoreMaxY do + for x in ProceduralMap.villageCoreMinX .. ProceduralMap.villageCoreMaxX do + let code = first.Tiles.[y * ProceduralMap.width + x] + if code = ProceduralMap.GroundTile.Water || code = ProceduralMap.GroundTile.Peat then yield (x, y, code) ] + Assert.AreEqual<(int * int * int) list>([], coreBad) + + [<TestMethod>] member _.WorldPanelDoesNotRenderA永久KeyList () = let world = Sim.initialWorldN 42UL 0 let lines = M5Interaction.panelLines world M5Interaction.initial |
