SimRateTests: probe the fast-gun capacitor on failure
This commit is contained in:
parent
93f69ecb80
commit
c00be8b35c
1 changed files with 3 additions and 1 deletions
|
|
@ -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<float>();
|
||||
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}");
|
||||
|
|
|
|||
Loading…
Reference in a new issue