Tests: the census counts the quarters' row, and the reach exemption is pinned to station plant

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
soul 2026-11-29 01:22:52 +01:00
commit bc6116d2ac
2 changed files with 29 additions and 0 deletions

View file

@ -155,6 +155,19 @@ public sealed partial class RunStartTests : IDisposable
private bool IsInstalledPlant(FactionProductData product) =>
product.NotOffered && _cache.Get(product.Design) is EquippableItemData design && design.HardpointType == HardpointType.Facility;
// The reach rule's one exemption is station plant: the Crew Quarters' product is, a not-offered product of interior gear is not, and an
// offered product of Facility gear is not (it is a draw like any other).
[Fact]
public void TheReachExemptionIsStationPlantOnly()
{
var quarters = _cache.Get<FactionProductData>(new CultRecordKey("product:habitation:crew-quarters"));
Assert.True(IsInstalledPlant(quarters));
var heater = _cache.GetAll<GearData>().First(LoadoutGenerator.IsHeater);
var heaterRef = new CultRecordRef<CraftedItemData>(_cache.RefOf(heater).Key);
Assert.False(IsInstalledPlant(new FactionProductData { Name = "Hidden Heater", Design = heaterRef, Manufacturer = quarters.Manufacturer, NotOffered = true }));
Assert.False(IsInstalledPlant(new FactionProductData { Name = "Offered Quarters", Design = quarters.Design, Manufacturer = quarters.Manufacturer, NotOffered = false }));
}
private string Maker(FactionProductData product) => product == null ? "nobody" : _cache.Get(product.Manufacturer)?.Name ?? "nobody";
// Every faction's stations, in a main-sector galaxy, carry a heater and a reactor, and nothing, equipped or

View file

@ -56,6 +56,22 @@ public sealed class StationFacilityRoomTests
if (hull.HullType == HullType.Station) Assert.Contains(hull.Hardpoints, row => row.Type == HardpointType.Facility);
}
// The census counts the Crew Quarters' row: with Zenith's rows cut to its kind's own facility (in memory), the faults name the Crew
// Quarters and nothing else; with the second row back they are empty.
[Fact]
public void TheCensusCountsTheCrewQuartersRow()
{
using var cache = RestoredHullsTests.OpenCatalog();
var zenith = Assert.Single(cache.GetAll<HullData>(), hull => hull.Name == "Zenith");
Assert.Empty(StationKinds.FacilityRoomFaults(cache));
var rows = zenith.Hardpoints.Where(row => row.Type == HardpointType.Facility).ToArray();
Assert.Equal(2, rows.Length);
zenith.Hardpoints.Remove(rows[1]);
var faults = StationKinds.FacilityRoomFaults(cache);
Assert.NotEmpty(faults);
Assert.All(faults, line => Assert.Contains("Crew Quarters", line));
}
// Positive control: Zenith's Facility rows taken away (in memory, on a read-only catalog), the census names the hull, a kind it
// serves and that kind's facility.
[Fact]