Tests: the drain and region pins read the ingredient shares
SortieOutputUnchangedByBoot (37 sold, 83 refused, 971 credits), AFullRefineryIsAStallFault (the shipped refinery waits Inputs holding goods whose partners did not come), ASaturatedRefineryIsNamed (a supplied refinery keeps its other recipes: no Room stall; the saturated fault is read on a sample that ends Room-stalled), RegionLegsFeedTheChain (RigRunningShare 0.17 -> 0.135, geometric mean of 16.5 and 11.0). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
e8c7d8e1d1
commit
45c7239f9f
2 changed files with 30 additions and 12 deletions
|
|
@ -50,13 +50,15 @@ public sealed class EconomyDrainTests
|
|||
}
|
||||
|
||||
// The sortie rig after Boot was lifted out of it, on the shipped catalog, read at the commit before the extraction; re-read at the authored starter
|
||||
// (131/73/58, 1295, 131 mined at the generated one): Light Lasers on the Energy mounts instead of the seed-1 draw.
|
||||
// (131/73/58, 1295, 131 mined at the generated one): Light Lasers on the Energy mounts instead of the seed-1 draw. What the refinery buys of the
|
||||
// 120 mined units is its shares of the stock bay (cut stationwants-ingredient-share): 37 sold and 83 refused (971 credits: the shares let the dear ores land that a Nickel-Iron intake crowded out,
|
||||
// against 72 sold and 970 unbounded); the mined units and the sortie's time are the rig's own and did not move.
|
||||
[Fact]
|
||||
public void SortieOutputUnchangedByBoot()
|
||||
{
|
||||
var sample = Seed1.Value.Single();
|
||||
Assert.Equal((120, 72, 48), (sample.Units, sample.UnitsSold, sample.UnitsRefused));
|
||||
Assert.Equal(970, sample.SellValue);
|
||||
Assert.Equal((120, 37, 83), (sample.Units, sample.UnitsSold, sample.UnitsRefused));
|
||||
Assert.Equal(971, sample.SellValue);
|
||||
Assert.Equal(150, sample.SimSeconds, 3);
|
||||
Assert.Equal(120, sample.Mined.Sum(m => m.Units));
|
||||
}
|
||||
|
|
@ -171,7 +173,11 @@ public sealed class EconomyDrainTests
|
|||
Assert.Contains(refinery.Ores, ore => ore.EmptyAt.HasValue);
|
||||
Assert.Null(refinery.FirstRoomStall);
|
||||
Assert.Equal(Stall.Inputs, refinery.Facilities.Single().HorizonEnd);
|
||||
Assert.DoesNotContain(EconomyDrain.Report(new[] { shipped }), f => f.Invariant == EconomyDrain.HStall);
|
||||
// The ore the sale brought lands only to its shares, so goods whose partners the sortie did not bring (Isoferroplatinum without Sperrylite,
|
||||
// Native Gold, Troilite without its partner) stay held while the refinery waits Inputs: the supply-bound stall, never a Room one.
|
||||
var held = Assert.Single(EconomyDrain.Report(new[] { shipped }), f => f.Invariant == EconomyDrain.HStall);
|
||||
Assert.Contains("stalled Inputs", held.Message);
|
||||
Assert.DoesNotContain("Room", held.Message);
|
||||
|
||||
// Positive control: a silo the batch cannot land in ends the horizon stalled Room with ore still held, which is the fault.
|
||||
var jammed = EconomyDrain.Run(Root, 1, 30, 4, Seed1.Value, beforeWindow: JamSilo);
|
||||
|
|
@ -182,8 +188,10 @@ public sealed class EconomyDrainTests
|
|||
Assert.Contains("Room", fault.Message);
|
||||
}
|
||||
|
||||
// Without outflow a supplied refinery saturates: products reach their share, the ores of full products are no longer bought, and the station
|
||||
// ends Room-stalled with ore it cannot use. The harness names it, so the region work that adds outflow is measured against it.
|
||||
// Without outflow a supplied refinery saturates: products reach their share and the ores of full products are no longer bought. Each ore comes
|
||||
// only to its share (ruling stations-buy-ingredients-to-target-share), so the shipped refinery keeps running the recipes whose products have
|
||||
// room: it never stalls Room, where an unbounded intake once filled every product, and the harness names no saturated station. The
|
||||
// saturated fault itself is read on a sample that ends Room-stalled.
|
||||
[Fact]
|
||||
public void ASaturatedRefineryIsNamed()
|
||||
{
|
||||
|
|
@ -191,11 +199,19 @@ public sealed class EconomyDrainTests
|
|||
var refinery = Station(supplied, "processing");
|
||||
Assert.NotNull(refinery.FirstSaturated);
|
||||
Assert.True(refinery.WantedEnd < refinery.WantedStart);
|
||||
Assert.Equal(Stall.Room, refinery.Facilities.Single().HorizonEnd);
|
||||
Assert.NotEmpty(refinery.Facilities.Single().Saturated);
|
||||
var fault = Assert.Single(EconomyDrain.Report(new[] { supplied }), f => f.Invariant == EconomyDrain.HSaturated);
|
||||
Assert.Null(refinery.FirstRoomStall);
|
||||
Assert.NotEqual(Stall.Room, refinery.Facilities.Single().HorizonEnd);
|
||||
Assert.DoesNotContain(EconomyDrain.Report(new[] { supplied }), f => f.Invariant == EconomyDrain.HSaturated);
|
||||
|
||||
var stalled = new DrainSample { Seed = 1, Supplied = true, HorizonHours = 24, Usable = 1 };
|
||||
stalled.Stations.Add(new StationDrain
|
||||
{
|
||||
Role = "processing", FirstSaturated = 3600, WantedStart = 20, WantedEnd = 4,
|
||||
Facilities = { new FacilityDrain { Name = "Refinery", HorizonEnd = Stall.Room, Saturated = { "Steel" }, OresLeft = { "Regolith" } } }
|
||||
});
|
||||
var fault = Assert.Single(EconomyDrain.Report(new[] { stalled }), f => f.Invariant == EconomyDrain.HSaturated);
|
||||
Assert.Contains("nothing taking them out", fault.Message);
|
||||
Assert.DoesNotContain(EconomyDrain.Report(new[] { supplied }), f => f.Invariant == EconomyDrain.HStall && f.Record.EndsWith("processing"));
|
||||
Assert.DoesNotContain(EconomyDrain.Report(new[] { stalled }), f => f.Invariant == EconomyDrain.HStall);
|
||||
|
||||
// One fill, no supply: nothing saturates, and the report names none.
|
||||
var once = EconomyDrain.Run(Root, 1, 30, 24, Seed1.Value);
|
||||
|
|
|
|||
|
|
@ -290,8 +290,10 @@ public sealed class EconomyRegionTests
|
|||
|
||||
// Bound (ruling lodur:ruling:deterministic-bound-margin, measured at the head on Starfire, Debug, seed 1, 24 sim h): the share of spans a
|
||||
// served rig is not stalled by Room. Without legs it reads 9.7 to 11 (the hold fills and nothing leaves); shipped, the least of the four
|
||||
// served rigs reads 26.3. sqrt(26.3 * 11) = 17.0, 1.55 from each.
|
||||
private const double RigRunningShare = 0.17;
|
||||
// served rigs reads 26.3. sqrt(26.3 * 11) = 17.0, 1.55 from each. Re-measured with the ingredient shares (cut stationwants-ingredient-share): a
|
||||
// refinery takes only its shares, so less leaves the rigs; shipped, the least of the four reads 16.5 and without legs the most reads 11.0 (no
|
||||
// legs: nothing leaves a hold, whatever the stations take). sqrt(16.5 * 11.0) = 13.5, 1.22 from each.
|
||||
private const double RigRunningShare = 0.135;
|
||||
|
||||
// The legs feed the chain: haulers carry what the mining stations make to the refineries of their faction, so those rigs drain (their
|
||||
// holds stop being full) and the refineries of the Pirates and Zhestokost run. An AU or Lucent rig is not required to drain.
|
||||
|
|
|
|||
Loading…
Reference in a new issue