From a9136cbcddeb8c6918467fa8d43b7719c56163e1 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Fri, 20 Nov 2026 06:18:14 +0100 Subject: [PATCH] Tests: the entry ramp's length is rounded, not floored Co-Authored-By: Claude Sonnet 5.5 --- tests/Lodur.Core.Tests/EntryRampTests.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/Lodur.Core.Tests/EntryRampTests.cs b/tests/Lodur.Core.Tests/EntryRampTests.cs index 8f2ec9f..82b985d 100644 --- a/tests/Lodur.Core.Tests/EntryRampTests.cs +++ b/tests/Lodur.Core.Tests/EntryRampTests.cs @@ -100,6 +100,21 @@ public sealed class EntryRampTests } } + [Fact] + public void The_ramp_length_is_rounded_to_whole_ticks_so_a_quotient_just_under_an_integer_gets_that_integer() + { + var rig = new Rig(StressThenCalm(0.29)); // 0.29 / 0.01 is 28.999999999999996 ticks, not 28 + rig.UntilTakeover(1); + for (var k = 1; k <= 29; k++) + { + rig.Tick(); + if (k < 29) Assert.True(rig.Actor.Drive.SensoryGain > 0.0, $"still ramping at tick {k}"); + } + + Assert.Equal(0.0, rig.Actor.Drive.SensoryGain); + Assert.Equal(0.0, rig.Actor.Drive.Arousal); + } + [Fact] public void A_goal_without_an_entry_arousal_ramps_only_the_gain_and_the_drive_keeps_arousal() {