From c00be8b35cda3d3cbf33039cb870c758e3b27c2f Mon Sep 17 00:00:00 2001 From: soul Date: Fri, 23 Oct 2026 00:15:58 +0200 Subject: [PATCH] SimRateTests: probe the fast-gun capacitor on failure --- tests/Aetheria.Shared.Tests/SimRateTests.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/Aetheria.Shared.Tests/SimRateTests.cs b/tests/Aetheria.Shared.Tests/SimRateTests.cs index 96a51f97b..2251e0a07 100644 --- a/tests/Aetheria.Shared.Tests/SimRateTests.cs +++ b/tests/Aetheria.Shared.Tests/SimRateTests.cs @@ -291,7 +291,9 @@ public sealed partial class ContactRevealTests var ship = Add(float3(0, 0, 0), new[] { GunWithCooldown(.01f) }, new[] { "Targeting", "Reactor" }); var fireTimes = new List(); var rounds = HoldTrigger(ship, Guns(ship)[0], dt, 10f, fireTimes); - Assert.True(abs(rounds.Count - 1000f) <= 1.01f, $"dt {dt}: {rounds.Count} rounds in 10 s, expected 1000 +-1"); + var probe = (InstantWeapon) Guns(ship)[0].Behaviors.Single(b => b is InstantWeapon); + var cap = (InputCapacitor) typeof(InstantWeapon).GetField("_capacitor", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(probe); + Assert.True(abs(rounds.Count - 1000f) <= 1.01f, $"dt {dt}: {rounds.Count} rounds in 10 s, expected 1000 +-1; capacity {cap.Capacity} rate {cap.Rate} charge {cap.Charge} cooldown {probe.Cooldown} canfire {probe.CanFire} firing {probe.Firing}"); Assert.Equal(rounds.Count, fireTimes.Count); for (var i = 1; i < fireTimes.Count; i++) Assert.True(abs(fireTimes[i] - fireTimes[i - 1] - .01f) < 2e-4f, $"dt {dt}: rounds {i - 1} and {i} born {fireTimes[i - 1]:R} and {fireTimes[i]:R}");