diff options
Diffstat (limited to 'src/LivingVillage.Desktop.Tests')
| -rw-r--r-- | src/LivingVillage.Desktop.Tests/PrototypeTests.fs | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/LivingVillage.Desktop.Tests/PrototypeTests.fs b/src/LivingVillage.Desktop.Tests/PrototypeTests.fs index 7e4ce5f..d77abd6 100644 --- a/src/LivingVillage.Desktop.Tests/PrototypeTests.fs +++ b/src/LivingVillage.Desktop.Tests/PrototypeTests.fs @@ -670,6 +670,41 @@ type PrototypeTests () = Assert.AreEqual<string option>(None, M5Interaction.refreshPrompt world needsView |> fun value -> value.Prompt) [<TestMethod>] + member _.DayPhaseLightingIsPureDeterministicAndTransitionsSmoothly () = + let ticksPerHour = Sim.ticksPerDay / 24L + let atHour hour = M6Presentation.lightingAtTick (int64 hour * ticksPerHour) + + // Anchors: full day at noon, full night at midnight, no drift. + Assert.AreEqual<float32>(0.0f, (atHour 12).Blend) + Assert.AreEqual<float32>(1.0f, (atHour 0).Blend) + Assert.AreEqual<float32>(1.0f, (atHour 2).Blend) + + // Dawn ramp: 4:00 -> 6:00 goes night -> day, monotonic. + let dawnStart = (atHour 4).Blend + let dawnMid = (M6Presentation.lightingAtTick (int64 5 * ticksPerHour)).Blend + let dawnEnd = (atHour 6).Blend + Assert.AreEqual<float32>(1.0f, dawnStart) + Assert.AreEqual<float32>(0.5f, dawnMid) + Assert.AreEqual<float32>(0.0f, dawnEnd) + + // Dusk ramp 20:00 -> 22:00 goes day -> night monotonically. + let duskStart = (atHour 20).Blend + let duskMid = (M6Presentation.lightingAtTick (int64 21 * ticksPerHour)).Blend + let duskEnd = (atHour 22).Blend + Assert.AreEqual<float32>(0.0f, duskStart) + Assert.AreEqual<float32>(0.5f, duskMid) + Assert.AreEqual<float32>(1.0f, duskEnd) + + // Determinism without randomness. + let once = atHour 13 + let twice = atHour 13 + Assert.AreEqual<M6RenderProfile>(once, twice) + + // Lantern glow: warm halo only rises with night blend. + Assert.AreEqual<float32>(0.0f, (atHour 13).LanternGlow) + Assert.AreEqual<float32>(1.0f, (atHour 0).LanternGlow) + + [<TestMethod>] member _.WorldPanelDoesNotRenderA永久KeyList () = let world = Sim.initialWorldN 42UL 0 let lines = M5Interaction.panelLines world M5Interaction.initial |
