From e94fc96680e5b7b1427180d327c40dc3e7d94464 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Thu, 26 Nov 2026 04:25:59 +0100 Subject: [PATCH] Tests: the pending plan is the plan in force on the commit tick Co-Authored-By: Claude Sonnet 5.5 --- tests/Lodur.Core.Tests/PlannerSelectTests.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/Lodur.Core.Tests/PlannerSelectTests.cs b/tests/Lodur.Core.Tests/PlannerSelectTests.cs index f22022e..2234053 100644 --- a/tests/Lodur.Core.Tests/PlannerSelectTests.cs +++ b/tests/Lodur.Core.Tests/PlannerSelectTests.cs @@ -361,6 +361,20 @@ public sealed class PlannerSelectTests Assert.Equal(expected[i], a.PlanStep(i)); } + // The pending plan becomes the plan in force on the tick the decision commits, before any later Select could make it again. + var c = Build(brain); + for (var i = 0; i < 60 && c.GoalIndex != 1; i++) + { + Run(c, 1, new[] { BoltedDoor(1) }); + } + + Assert.Equal(1, c.GoalIndex); + Assert.Equal(4, c.PlanLength); + for (var i = 0; i < 4; i++) + { + Assert.Equal(expected[i], c.PlanStep(i)); + } + // The door is sensed unlocked while the Select re-chooses the pair: the plan shortens the same tick. Run(a, 1, new[] { PlainDoor(1) }); Assert.Equal(2, a.PlanLength);