From aa5e45a2ffa1790d4596f09dfeddd227faa3faac Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sat, 10 Oct 2026 07:59:36 +0200 Subject: [PATCH] ThrustAllocator tests: IterationLimit keeps the solver's iterate (iteration-limit-untested) 128 torque-free forward thrusters from a cold start reach the 100-iteration cap through the public surface; the call must keep the iterate it reached, not zero it. Commit builds: yes (tests/Aetheria.Shared.Tests not yet run on this commit; the full run is the closing job). Co-Authored-By: Claude Opus 5.5 --- .../Aetheria.Shared.Tests/ThrustAllocatorTests.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/Aetheria.Shared.Tests/ThrustAllocatorTests.cs b/tests/Aetheria.Shared.Tests/ThrustAllocatorTests.cs index 26c50e35d..1f956eafb 100644 --- a/tests/Aetheria.Shared.Tests/ThrustAllocatorTests.cs +++ b/tests/Aetheria.Shared.Tests/ThrustAllocatorTests.cs @@ -311,4 +311,18 @@ public class ThrustAllocatorTests for (var i = 0; i < warm.Length; i++) Assert.True(MathF.Abs(warm[i] - fresh[i]) <= 1e-5f, $"throttle {i}: {warm[i]} vs {fresh[i]}"); Assert.True(warm[1] > .9f, $"{warm[1]}"); } + + [Fact] + public void AtTheIterationCapTheIterateIsKept() + { + // 128 torque-free forward thrusters from a cold start: the active set frees about one throttle per iteration, so + // the solver stops at its iteration cap (measured: IterationLimit at 100). TA-R4 keeps the iterate it reached, + // which already carries a share of the forward demand; a call that zeroed it would give nothing. + var forward = new float3[128]; + for (var i = 0; i < forward.Length; i++) forward[i] = Col(0, 30f + i % 7, 0); + var throttle = Solve(forward, 0, 1, 0); + var reached = Net(forward, throttle).y; + var extreme = Extremes(forward, 1).plus; + Assert.True(reached > .1f * extreme, $"{reached} of {extreme}"); + } }