Boss tests: a null faction has no boss hull; an unbuildable boss Loadout lists every failure
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
e47bb27ef8
commit
90f977bf19
1 changed files with 19 additions and 1 deletions
|
|
@ -281,6 +281,21 @@ public sealed partial class RunStartTests
|
||||||
Assert.Empty(LoadoutGenerator.BossHullsOf(_cache, null));
|
Assert.Empty(LoadoutGenerator.BossHullsOf(_cache, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// No faction has no boss hulls, even when a Boss hull has a product with no maker (which a null faction would equal).
|
||||||
|
[Fact]
|
||||||
|
public void No_faction_has_no_boss_hull()
|
||||||
|
{
|
||||||
|
var galaxy = DemoGalaxy(1);
|
||||||
|
var orphan = MakeBoss("Orphan Boss", 100);
|
||||||
|
var key = _cache.RefOf(orphan).Key;
|
||||||
|
_cache.Upsert(new FactionProductData { Name = "Orphan product", Design = new CultRecordRef<CraftedItemData>(key) });
|
||||||
|
|
||||||
|
Assert.Empty(LoadoutGenerator.BossHullsOf(_cache, null));
|
||||||
|
Assert.Null(Loadouts.BossOf(_cache, null, out var refusal));
|
||||||
|
Assert.Equal(BossRefusal.NoBossHull, refusal);
|
||||||
|
Assert.Empty(LoadoutGenerator.BossHullsOf(_cache, Zhestokost(galaxy)));
|
||||||
|
}
|
||||||
|
|
||||||
// A Boss hull whose product has no Loadout is refused typed at the derivation. The refusal names the missing field and
|
// A Boss hull whose product has no Loadout is refused typed at the derivation. The refusal names the missing field and
|
||||||
// echoes no input: the canary hull name, its product's name and the record keys reach no log line.
|
// echoes no input: the canary hull name, its product's name and the record keys reach no log line.
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|
@ -590,6 +605,7 @@ public sealed partial class RunStartTests
|
||||||
var hull = MakeBoss("Boss A", 100, antagonist);
|
var hull = MakeBoss("Boss A", 100, antagonist);
|
||||||
var loadout = MakeBossLoadout(hull, antagonist, "Unfittable loadout");
|
var loadout = MakeBossLoadout(hull, antagonist, "Unfittable loadout");
|
||||||
loadout.Slots[0].Position = new int2(999, 999);
|
loadout.Slots[0].Position = new int2(999, 999);
|
||||||
|
loadout.Slots[1].Position = new int2(998, 998);
|
||||||
StoreLoadout(loadout);
|
StoreLoadout(loadout);
|
||||||
Assert.Equal("Unfittable loadout", Loadouts.BossOf(_cache, antagonist, out _).Name);
|
Assert.Equal("Unfittable loadout", Loadouts.BossOf(_cache, antagonist, out _).Name);
|
||||||
|
|
||||||
|
|
@ -598,7 +614,9 @@ public sealed partial class RunStartTests
|
||||||
var pack = BossZonePack(galaxy, items, galaxy.Exit, ambient: false);
|
var pack = BossZonePack(galaxy, items, galaxy.Exit, ambient: false);
|
||||||
Assert.False(pack.BossSpawned);
|
Assert.False(pack.BossSpawned);
|
||||||
Assert.DoesNotContain(pack.Entities, entity => entity.Boss);
|
Assert.DoesNotContain(pack.Entities, entity => entity.Boss);
|
||||||
Assert.Contains(log, line => line.Contains("Unfittable loadout") && line.Contains("does not fit"));
|
var refusal = Assert.Single(log, line => line.Contains("Unfittable loadout") && line.Contains("does not fit"));
|
||||||
|
Assert.Equal(2, Regex.Matches(refusal, "does not fit").Count);
|
||||||
|
Assert.Contains("; ", refusal);
|
||||||
Assert.False(RunGoal.ExitOpen(new Zone(items, _planetSettings, pack, galaxy.Exit, galaxy)));
|
Assert.False(RunGoal.ExitOpen(new Zone(items, _planetSettings, pack, galaxy.Exit, galaxy)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue