From 65f8eb8aec3f86d3615af375a07bf022c0244d82 Mon Sep 17 00:00:00 2001 From: soul Date: Sat, 28 Nov 2026 12:23:25 +0100 Subject: [PATCH] Tests that stage or generate without the demo entrance: ring arenas stage the player without the entrance's haul order; the cramped-hull heater test uses a kind with no facilities Co-Authored-By: Claude Sonnet 5.5 --- tests/Aetheria.Shared.Tests/DemoPressureTests.cs | 11 ++++++++++- tests/Aetheria.Shared.Tests/RunStartTests.cs | 7 +++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/tests/Aetheria.Shared.Tests/DemoPressureTests.cs b/tests/Aetheria.Shared.Tests/DemoPressureTests.cs index 0c6ea5245..850e19b36 100644 --- a/tests/Aetheria.Shared.Tests/DemoPressureTests.cs +++ b/tests/Aetheria.Shared.Tests/DemoPressureTests.cs @@ -278,7 +278,16 @@ public sealed partial class RunStartTests adjust?.Invoke(pack); var arena = new Zone(_items, _planetSettings, pack, zone, galaxy); var failures = new List(); - var staged = RunStart.Stage(_items, arena, new DemoTerminus(), _startingHull, failures); + // The demo's player and stances, without its entrance's haul order: a ring arena holds no Zenith or refinery to order between. + var staged = RunStart.Stage(_items, arena, new Scripted(false, stage => + { + stage.Galaxy.FactionRelationships[stage.Galaxy.ResolveFaction(DemoTerminus.Cast.ProtagonistFaction)] = FactionRelationship.Friendly; + stage.Galaxy.FactionRelationships[stage.Galaxy.ResolveFaction(DemoTerminus.Cast.AntagonistFaction)] = FactionRelationship.Hated; + stage.Galaxy.FactionRelationships[stage.Galaxy.ResolveFaction(DemoTerminus.Cast.BufferFaction)] = FactionRelationship.Neutral; + foreach (var neutral in DemoTerminus.Cast.NeutralFactions) + stage.Galaxy.FactionRelationships[stage.Galaxy.ResolveFaction(neutral)] = FactionRelationship.Neutral; + stage.Player(stage.Generated("Longinus"), float2.zero); + }), _startingHull, failures); Assert.True(failures.Count == 0, string.Join("; ", failures)); arena.Update(0); return (arena, staged.Player); diff --git a/tests/Aetheria.Shared.Tests/RunStartTests.cs b/tests/Aetheria.Shared.Tests/RunStartTests.cs index ded69be9c..4dbb1cbc2 100644 --- a/tests/Aetheria.Shared.Tests/RunStartTests.cs +++ b/tests/Aetheria.Shared.Tests/RunStartTests.cs @@ -311,7 +311,10 @@ public sealed partial class RunStartTests : IDisposable .OrderBy(design => design.Shape.Coordinates.Length).ThenBy(design => design.Name, StringComparer.Ordinal).First(); var shape = new Shape(bay.Shape.Width + 2, bay.Shape.Height + 2); foreach (var cell in shape.AllCoordinates) shape[cell] = true; - var cramped = new HullData { Name = "Cramped Station", HullType = HullType.Station, Kind = TestStationKinds.TradeHub, Shape = shape, Durability = 100, Mass = 1000, Price = 1 }; + // A kind with no facilities: the shipped trade hub now seats a silo, which a hull this small has no Facility row for. + var bare = new CultRecordRef(StationKindData.KeyOf("cramped")); + _cache.Commit(batch => batch.Upsert(typeof(StationKindData), new StationKindData { Name = "Cramped" }, bare.Key)); + var cramped = new HullData { Name = "Cramped Station", HullType = HullType.Station, Kind = bare, Shape = shape, Durability = 100, Mass = 1000, Price = 1 }; _cache.Upsert(cramped); _cache.Upsert(new FactionProductData { @@ -321,7 +324,7 @@ public sealed partial class RunStartTests : IDisposable hull.Price = 0; // generation offers no zero-price design, so the cramped hull is the only station var generator = new LoadoutGenerator(ref _items.Random, _items, _galaxy, _galaxy.Entrance, _protagonist, .5f); - var failure = Assert.Throws(() => generator.GenerateStationLoadout(TestStationKinds.TradeHub)); + var failure = Assert.Throws(() => generator.GenerateStationLoadout(bare)); Assert.Contains("heater", failure.Message); }