summaryrefslogtreecommitdiff
path: root/src/LivingVillage.Kernel.Tests/M6aTests.fs
diff options
context:
space:
mode:
authorSomhairle H. Marisol <[email protected]>2026-09-22 08:21:32 +0800
committerSomhairle H. Marisol <[email protected]>2026-09-22 08:21:32 +0800
commit7dfd58b71568e28fc591b55765635f3f32ad01e5 (patch)
tree2d90c06a7862935858d3435805b3af186bbd310b /src/LivingVillage.Kernel.Tests/M6aTests.fs
parentfa20cc35eab8b597707bebc0ff8ef0e2ccb58d47 (diff)
parent91d3e7dc95981f92f56a82c19334b5c26d52c226 (diff)
downloadliving-village-7dfd58b71568e28fc591b55765635f3f32ad01e5.tar.gz
merge: P23 512x384 扩程(writer hash 保留)
Diffstat (limited to 'src/LivingVillage.Kernel.Tests/M6aTests.fs')
-rw-r--r--src/LivingVillage.Kernel.Tests/M6aTests.fs26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/LivingVillage.Kernel.Tests/M6aTests.fs b/src/LivingVillage.Kernel.Tests/M6aTests.fs
index 9348b0f..94341a1 100644
--- a/src/LivingVillage.Kernel.Tests/M6aTests.fs
+++ b/src/LivingVillage.Kernel.Tests/M6aTests.fs
@@ -314,3 +314,29 @@ type M6aTests () =
finally
Sim.configureBounds 64 48
if File.Exists path then File.Delete path
+
+ /// P23:512x384 参数化边界在存档 v2 中 round-trip;同 world 两次保存逐字节一致,
+ /// 读回后再次保存仍与原文一致(v1 的 64x48 兼容由 SaveV1LegacyStillReadable 覆盖)。
+ [<TestMethod>]
+ member _.SaveRoundTrips512x384BoundsAndIsByteStable () =
+ let path = "p23-bounds-512-v2.save"
+ let path2 = path + ".2"
+ try
+ Sim.configureBounds 512 384
+ let world = Sim.initialWorld (uint64 4242)
+ WorldSave.saveToFile path world
+ WorldSave.saveToFile path2 world
+ let text = File.ReadAllText path
+ Assert.IsTrue(text.StartsWith("LV_WORLD_SAVE_V2"), "bounds save must stay v2")
+ Assert.AreEqual<string>(text, File.ReadAllText path2)
+ Sim.configureBounds 64 48
+ match WorldSave.loadFromFile path with
+ | Error failure -> Assert.Fail(sprintf "512x384 bounds save should load: %s" failure)
+ | Ok restored ->
+ Assert.AreEqual<int>(512, Sim.mapWidthTiles)
+ Assert.AreEqual<int>(384, Sim.mapHeightTiles)
+ Assert.AreEqual<string>(text, WorldSave.save restored)
+ finally
+ Sim.configureBounds 64 48
+ if File.Exists path then File.Delete path
+ if File.Exists path2 then File.Delete path2