ProductChoiceTests: the draw follows the outfitter's preference
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
4609f148a2
commit
94ab2d3f50
1 changed files with 16 additions and 2 deletions
|
|
@ -35,7 +35,7 @@ public sealed class ProductChoiceTests : IDisposable
|
|||
public CultCache Cache;
|
||||
public ItemManager Items;
|
||||
public Galaxy Galaxy;
|
||||
public Faction OutA, OutZ;
|
||||
public Faction OutA, OutZ, OutBoth;
|
||||
|
||||
public LoadoutGenerator Outfitter(Faction faction, uint seed)
|
||||
{
|
||||
|
|
@ -75,6 +75,7 @@ public sealed class ProductChoiceTests : IDisposable
|
|||
var mu = seed.Upsert(new Faction { Name = "Mu", ShortName = "MU" });
|
||||
seed.Upsert(new Faction { Name = "OutA", ShortName = "OTA", Allegiance = { { alpha, 1f } } });
|
||||
seed.Upsert(new Faction { Name = "OutZ", ShortName = "OTZ", Allegiance = { { zeta, 1f } } });
|
||||
seed.Upsert(new Faction { Name = "OutBoth", ShortName = "OTB", Allegiance = { { alpha, 1f }, { zeta, .1f } } });
|
||||
var shape = new Shape(3, 3);
|
||||
foreach (var cell in shape.AllCoordinates) shape[cell] = true;
|
||||
var skiff = seed.Upsert(new HullData
|
||||
|
|
@ -115,7 +116,7 @@ public sealed class ProductChoiceTests : IDisposable
|
|||
RunSave.Commit(cache, game, zones, new ProvenanceLedger());
|
||||
return new Rig
|
||||
{
|
||||
Cache = cache, OutA = outA, OutZ = outZ,
|
||||
Cache = cache, OutA = outA, OutZ = outZ, OutBoth = cache.GetByName<Faction>("OutBoth"),
|
||||
Items = new ItemManager(cache, new ProvenanceLedger(), RunSaveTests.TestSettings(), _ => { }),
|
||||
Galaxy = new Galaxy(cache, cache.GetGlobal<SavedGame>(), _ => { })
|
||||
};
|
||||
|
|
@ -134,6 +135,19 @@ public sealed class ProductChoiceTests : IDisposable
|
|||
Assert.Empty(failures);
|
||||
}
|
||||
|
||||
// An outfitter that reaches both makers favors the one its allegiance weighs ten times heavier: the draw follows
|
||||
// ManufacturerPreference rather than splitting evenly.
|
||||
[Fact]
|
||||
public void TheDrawFollowsTheOutfittersPreference()
|
||||
{
|
||||
var rig = Build("lamp-z", "lamp-a");
|
||||
var lamp = rig.Cache.GetByName<GearData>("Lamp");
|
||||
var drawn = Enumerable.Range(1, 200).Select(seed => rig.Outfitter(rig.OutBoth, (uint) seed).ChooseProduct(lamp).Name).ToArray();
|
||||
var alpha = drawn.Count(name => name == "lamp-a");
|
||||
Assert.InRange(alpha, 160, 199);
|
||||
Assert.Contains("lamp-z", drawn);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ANullFactionDrawIsSeededAndReachesEveryMaker()
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue