Tests: Pirates allegiance count is the other factions' count, not 12; gear draw seeds spread by a hash
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
1191aa1423
commit
51fc64de31
2 changed files with 10 additions and 2 deletions
|
|
@ -135,7 +135,8 @@ public sealed partial class RunStartTests
|
|||
return new LoadoutGenerator(ref _items.Random, _items, _galaxy, _galaxy.Entrance, factions.Single(f => f.ShortName == shortName), .5f);
|
||||
}
|
||||
Assert.True(For("AU", 1).IsAvailable(pattern30));
|
||||
Assert.Contains(Enumerable.Range(1, 64), seed => For("AU", (uint) seed).ChooseProduct(autocannon)?.Name == pattern30.Name);
|
||||
// Seeds 1-64 spread by a multiplicative hash: the generator's first draws of adjacent small seeds are close together.
|
||||
Assert.Contains(Enumerable.Range(1, 64), seed => For("AU", unchecked((uint) seed * 2654435761u)).ChooseProduct(autocannon)?.Name == pattern30.Name);
|
||||
|
||||
var terri = For("Miss Terri's", 1);
|
||||
var theirs = _cache.GetAll<FactionProductData>().Where(p => new[] { "Aya", "Megiddo", "Forge" }.Contains(_cache.Get(p.Manufacturer).ShortName)).ToArray();
|
||||
|
|
|
|||
|
|
@ -39,6 +39,13 @@ public sealed class PiratesFactionCommandTests : IDisposable
|
|||
|
||||
public void Dispose() => Directory.Delete(_root, true);
|
||||
|
||||
private int AllFactionsButThePirates()
|
||||
{
|
||||
var db = AetherDb.Open(root: _root);
|
||||
try { return db.Cache.GetAll<Faction>().Count(f => f.Name != "Pirates"); }
|
||||
finally { db.Cache.Dispose(); }
|
||||
}
|
||||
|
||||
private (Faction[] Pirates, FactionProductData[] Products) Read()
|
||||
{
|
||||
var db = AetherDb.Open(root: _root);
|
||||
|
|
@ -69,7 +76,7 @@ public sealed class PiratesFactionCommandTests : IDisposable
|
|||
Assert.Equal(3, faction.InfluenceDistance);
|
||||
Assert.Equal(new CultMath.float3(.42f, .40f, .37f), faction.PrimaryColor);
|
||||
Assert.Equal(new CultMath.float3(1f, .45f, .05f), faction.SecondaryColor);
|
||||
Assert.Equal(12, faction.Allegiance.Count);
|
||||
Assert.Equal(AllFactionsButThePirates(), faction.Allegiance.Count);
|
||||
Assert.All(faction.Allegiance.Values, value => Assert.Equal(1f, value));
|
||||
|
||||
var db = AetherDb.Open(root: _root);
|
||||
|
|
|
|||
Loading…
Reference in a new issue