From 0af394bd4b5608c67663ef4f5ad8658ab2d72166 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Mon, 12 Oct 2026 03:03:43 +0200 Subject: [PATCH] Exact-gate departure test: the observer sits where its info per unit light is a power of two (previous commit's test does not pass) Co-Authored-By: Claude Opus 5.5 --- .../ContactRevealTests.cs | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/tests/Aetheria.Shared.Tests/ContactRevealTests.cs b/tests/Aetheria.Shared.Tests/ContactRevealTests.cs index 5b5075042..a1aabcfd6 100644 --- a/tests/Aetheria.Shared.Tests/ContactRevealTests.cs +++ b/tests/Aetheria.Shared.Tests/ContactRevealTests.cs @@ -645,27 +645,20 @@ public sealed class ContactRevealTests : IDisposable } // The gate is strict, as the light-act gate is: a light at removal that lands exactly on the threshold ends nothing. - // The signature is searched, a few floats either side of threshold over info, for the one whose product with the - // observer's info on the spot is exactly the threshold. + // At 32 the observer's info per unit light is 4 / 32, a power of two, so threshold x 8 is the light whose product + // with it is exactly the threshold. [Fact] public void ADepartureExactlyAtTheLightActGateEndsNothing() { - var e = Add(float3(0, 0, 100), new[] { "Gun" }); + var e = Add(float3(0, 0, 32), new[] { "Gun" }); var o = Add(float3(0, 0, 0), new[] { "Eye" }); Fire(e, Guns(e)[0]); Tick(.01f); Assert.Single(o.RevealsOf(e)); var threshold = _items.GameplaySettings.TargetDetectionInfoThreshold; - var info = o.PassiveInfo(e.Position.xz, 1f); - var signature = threshold / info; - for (var step = 0; step < 8 && signature * info != threshold; step++) - signature = BitConverter.Int32BitsToSingle(BitConverter.SingleToInt32Bits(signature) + 1); - if (signature * info != threshold) signature = threshold / info; - for (var step = 0; step < 16 && signature * info != threshold; step++) - signature = BitConverter.Int32BitsToSingle(BitConverter.SingleToInt32Bits(signature) - 1); - Assert.True(signature * info == threshold, "fixture: a light exactly at the gate exists"); - ShowOnly(e, signature, Guns(e)[0]); - Assert.True(e.Visibility * info == threshold, "fixture: the ship's light at removal is exactly the gate"); + Assert.Equal(.125f, o.PassiveInfo(e.Position.xz, 1f)); + ShowOnly(e, threshold * 8f, Guns(e)[0]); + Assert.True(e.Visibility * o.PassiveInfo(e.Position.xz, 1f) == threshold, "fixture: the ship's light at removal is exactly the gate"); _zone.Entities.Remove(e); Tick(.1f);