b451f83174
Captures the pre-Godot-port state of the codebase. This is the rollback anchor for the Godot port (M0 of theriapolis-rpg-implementation-plan-godot-port.md). All Phase 0 through Phase 6.5 work is included; Phase 7 is in flight. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
53 lines
1.7 KiB
C#
53 lines
1.7 KiB
C#
using Theriapolis.Core.World.Generation;
|
|
using Xunit;
|
|
|
|
namespace Theriapolis.Tests.Determinism;
|
|
|
|
/// <summary>
|
|
/// Phase 2+3 determinism contract: same seed → identical settlements and polylines.
|
|
/// Uses variant 0 and variant 1 so the fixture returns two independent pipeline
|
|
/// runs rather than comparing one cached context to itself.
|
|
/// </summary>
|
|
public sealed class Phase23DeterminismTests : IClassFixture<WorldCache>
|
|
{
|
|
private const ulong TestSeed = 0xCAFEBABEUL;
|
|
private readonly WorldCache _cache;
|
|
|
|
public Phase23DeterminismTests(WorldCache cache) => _cache = cache;
|
|
|
|
[Fact]
|
|
public void SameSeed_ProducesIdenticalSettlements()
|
|
{
|
|
var h1 = _cache.Get(TestSeed, variant: 0).World.HashSettlements();
|
|
var h2 = _cache.Get(TestSeed, variant: 1).World.HashSettlements();
|
|
Assert.Equal(h1, h2);
|
|
}
|
|
|
|
[Fact]
|
|
public void SameSeed_ProducesIdenticalPolylines()
|
|
{
|
|
var h1 = _cache.Get(TestSeed, variant: 0).World.HashPolylines();
|
|
var h2 = _cache.Get(TestSeed, variant: 1).World.HashPolylines();
|
|
Assert.Equal(h1, h2);
|
|
}
|
|
|
|
[Fact]
|
|
public void DifferentSeeds_ProduceDifferentSettlements()
|
|
{
|
|
var h1 = _cache.Get(TestSeed).World.HashSettlements();
|
|
var h2 = _cache.Get(TestSeed + 7).World.HashSettlements();
|
|
Assert.NotEqual(h1, h2);
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData(0xABCD1234UL)]
|
|
[InlineData(0x00000001UL)]
|
|
[InlineData(0xDEADBEEFUL)]
|
|
public void MultipleSeeds_SettlementsAreDeterministic(ulong seed)
|
|
{
|
|
var h1 = _cache.Get(seed, variant: 0).World.HashSettlements();
|
|
var h2 = _cache.Get(seed, variant: 1).World.HashSettlements();
|
|
Assert.Equal(h1, h2);
|
|
}
|
|
}
|