summaryrefslogtreecommitdiff
path: root/src/LivingVillage.Desktop.Tests
diff options
context:
space:
mode:
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"