Tests: the drain's crew line reads what the quarters asked of the hold, by the shipped off-screen step

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
soul 2026-11-29 01:42:37 +01:00
commit 4d1b63a5ab

View file

@ -61,8 +61,7 @@ public sealed class EconomyDrainTests
Assert.Equal(120, sample.Mined.Sum(m => m.Units));
}
// The crew's draw is read apart from the facilities' (finding crew-draw-unmeasured): each station's quarters are stepped through every
// span of the horizon beside its facilities, and the drain prints what they took per sim hour and the spans they went short in. The
// and the spans they went short in. The shipped stations hold no Water, Oxygen or Algae to start with, so the crew is short in most spans.
// shipped stations hold no Water, Oxygen or Algae to start with, so the crew is short in every span and takes nothing.
[Fact]
public void TheDrainReadsTheCrewApartFromTheFacilities()
@ -72,10 +71,10 @@ public sealed class EconomyDrainTests
{
var crew = Assert.Single(station.Crew);
Assert.Equal(("Crew Quarters", 20, 120, 7200.0), (crew.Name, crew.Occupants, crew.Spans, crew.Seconds));
Assert.Equal(new[] { "Algae", "Oxygen", "Water" }, crew.Taken.Keys.OrderBy(name => name, StringComparer.Ordinal));
Assert.All(crew.Taken.Values, taken => Assert.Equal(0, taken));
// Twenty occupants over two hours at the drafted rates: Water 2.0, Oxygen 1.5 and Algae 1.0 per occupant hour.
Assert.Equal(new[] { ("Algae", 40.0), ("Oxygen", 60.0), ("Water", 80.0) }, crew.Asked.OrderBy(kv => kv.Key, StringComparer.Ordinal).Select(kv => (kv.Key, Math.Round(kv.Value, 6))));
Assert.True(crew.ShortSpans > crew.Spans / 2, $"short in {crew.ShortSpans} of {crew.Spans} spans");
Assert.Contains("crew Crew Quarters (20 occupants): per sim hour took ", Printed(sample));
Assert.Contains("crew Crew Quarters (20 occupants): per sim hour asked ", Printed(sample));
}
}