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 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-10 07:59:36 +02:00
commit aa5e45a2ff

View file

@ -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}");
}
}