summaryrefslogtreecommitdiff
path: root/src/LivingVillage.Desktop.Tests
diff options
context:
space:
mode:
authorSomhairle H. Marisol <[email protected]>2026-09-21 15:48:25 +0800
committerSomhairle H. Marisol <[email protected]>2026-09-21 15:48:25 +0800
commitd10689d10ff111980bac98c0a062b47e3185c750 (patch)
treead4ff01447a5a9ba4979f3eb11ce93baed5dc3de /src/LivingVillage.Desktop.Tests
parent3ee243016eb443c93e9494489ced513f5e304870 (diff)
downloadliving-village-d10689d10ff111980bac98c0a062b47e3185c750.tar.gz
fix(headless): worldDigest 规范化恢复性能基线字节口径
快照与存档版本头/sh与边界 token 解耦:WorldDigestOfText 先把 V2 存档剥出正文并重建 LV_WORLD_SAVE_V1 常量语义再 SHA256;digest 只绑定模拟状态;新增 WorldDigestIsCanonical 同 V1/V2 双读路径 digest 相等回归;--performance-baseline 3 次独立运行 final_digest 复回 953775FAEB2F…(与历史基线逐字节一致),证据在 artifacts/perf-independent/新时间戳/README。
Diffstat (limited to 'src/LivingVillage.Desktop.Tests')
-rw-r--r--src/LivingVillage.Desktop.Tests/PrototypeTests.fs18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/LivingVillage.Desktop.Tests/PrototypeTests.fs b/src/LivingVillage.Desktop.Tests/PrototypeTests.fs
index dc1414a..bf8fa82 100644
--- a/src/LivingVillage.Desktop.Tests/PrototypeTests.fs
+++ b/src/LivingVillage.Desktop.Tests/PrototypeTests.fs
@@ -1,6 +1,7 @@
namespace LivingVillage.Desktop.Tests
open System
+open LivingVillage.Headless
open System.IO
open Microsoft.Xna.Framework
open Microsoft.VisualStudio.TestTools.UnitTesting
@@ -870,6 +871,23 @@ type PrototypeTests () =
Assert.IsTrue(File.Exists(runtimeAssetPath ()), sprintf "Missing atlas PNG: %s" (runtimeAssetPath ()))
[<TestMethod>]
+ member _.WorldDigestIsCanonicalAcrossSaveFormatVersions () =
+ // The digest must bind to simulation state only: a world presented as a
+ // legacy V1 save text and as the new V2 save text must share one digest.
+ let world = Sim.initialWorldN (uint64 42) 4
+ let v2Text = WorldSave.save world
+
+ let firstPipe = v2Text.IndexOf('|')
+ let secondPipe = v2Text.IndexOf('|', firstPipe + 1)
+ let thirdPipe = v2Text.IndexOf('|', secondPipe + 1)
+ let v1Text = ("LV_WORLD_SAVE_V1" + v2Text.Substring(thirdPipe))
+
+ // v1/v2 same-world digest equality (RED before canonical digest exists).
+ let digestOfV1 = PerformanceProbe.WorldDigestOfText v1Text
+ Assert.AreEqual<string>(digestOfV1, PerformanceProbe.WorldDigestOfText v2Text)
+ // 953775FA 硬对齐由 --performance-baseline 于 finalWorld 支线证据。
+
+ [<TestMethod>]
member _.JiangnanArtAssetsArePackagedAsRealPngFiles () =
let requiredAssets =
[ "Assets/jiangnan-world.png"