Tests: the floor's stick-independence at the allocator; throttle-lock twin diagnostics
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
3400268681
commit
9ff6e4ba42
2 changed files with 7 additions and 2 deletions
|
|
@ -137,7 +137,8 @@ public sealed class ThrottleLockTests : IDisposable
|
|||
ship.Ship.Turn = twin.Ship.Turn = turn;
|
||||
ship.Ship.Update(dt);
|
||||
twin.Ship.Update(dt);
|
||||
Assert.True(Apart(Axes(ship), Axes(twin)) < 1e-6f, "the ship's throttles differ from its full-forward twin's");
|
||||
var apart = Apart(Axes(ship), Axes(twin));
|
||||
Assert.True(apart < 1e-6f, $"the ship's throttles differ from its full-forward twin's by {apart}: [{string.Join(" ", Axes(ship))}] against [{string.Join(" ", Axes(twin))}]");
|
||||
Assert.True(twin.Forward.Axis > .98f, "fixture: the twin's forward drive is at full");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -435,7 +435,11 @@ public class ThrustAllocatorTests
|
|||
var throttle = new float[hull.Length];
|
||||
allocator.Allocate(hull, new float2(1, -1), turn, throttle, forwardFloor: true);
|
||||
Assert.All(throttle.Take(3), t => Assert.True(t > .9999f, "a forward-pushing column holds full"));
|
||||
Assert.True(throttle[4] < 1e-3f, "reverse stays off: the stick is ignored under the floor");
|
||||
|
||||
var blind = new float[hull.Length];
|
||||
new ThrustAllocator().Allocate(hull, default, turn, blind, forwardFloor: true);
|
||||
var apart = throttle.Zip(blind, (a, b) => MathF.Abs(a - b)).Max();
|
||||
Assert.True(apart < 1e-6f, $"the stick changed the floored throttles by {apart}");
|
||||
|
||||
var open = new float[hull.Length];
|
||||
new ThrustAllocator().Allocate(hull, new float2(0, 1), turn, open);
|
||||
|
|
|
|||
Loading…
Reference in a new issue