From a0488275c6e0be034b7e95b4a75f63730a91d79c Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Fri, 20 Nov 2026 00:45:30 +0100 Subject: [PATCH] Pin that arousal updates before it drains resolve on the same tick Co-Authored-By: Claude Sonnet 5.5 --- tests/Lodur.Core.Tests/ArousalTests.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/Lodur.Core.Tests/ArousalTests.cs b/tests/Lodur.Core.Tests/ArousalTests.cs index 92d3325..b02c5d9 100644 --- a/tests/Lodur.Core.Tests/ArousalTests.cs +++ b/tests/Lodur.Core.Tests/ArousalTests.cs @@ -122,6 +122,24 @@ public sealed class ArousalTests Assert.True(rig.Actor.Drive.Resolve > minResolve); } + [Fact] + public void Arousal_updates_before_it_drains_resolve_on_the_same_tick() + { + var rig = new SensoryRig(SensoryRig.One(0.55), pull: 0.5); + for (var i = 0; i < 100; i++) + { + rig.Tick(); + if (rig.Actor.Load > 0.0) break; + Assert.Equal(0.0, rig.Actor.Drive.Arousal); + Assert.Equal(1.0, rig.Actor.Drive.Resolve); + } + + Assert.True(rig.Actor.Load > 0.0, "the load arrives within the conduction delay"); + // On the tick the load first arrives, arousal has already risen and already drained: read a tick late, resolve would still be 1. + Assert.True(rig.Actor.Drive.Arousal > 0.0); + Assert.True(rig.Actor.Drive.Resolve < 1.0); + } + [Fact] public void Without_emitters_or_without_senses_arousal_and_load_stay_exactly_zero() {