Initial commit: Theriapolis baseline at port/godot branch point
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>
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
using Theriapolis.Core.World.Generation;
|
||||
using Xunit;
|
||||
|
||||
namespace Theriapolis.Tests.Determinism;
|
||||
|
||||
/// <summary>
|
||||
/// Phase 1 determinism contract:
|
||||
/// seed 0xCAFEBABE run twice → byte-identical elevation, moisture, temperature,
|
||||
/// and biome arrays.
|
||||
///
|
||||
/// Uses variant 0 and variant 1 so the WorldCache fixture returns two
|
||||
/// independent pipeline runs of the same seed (otherwise comparing the cached
|
||||
/// context against itself would prove nothing).
|
||||
/// </summary>
|
||||
public sealed class WorldgenDeterminismTests : IClassFixture<WorldCache>
|
||||
{
|
||||
private const ulong TestSeed = 0xCAFEBABEUL;
|
||||
private readonly WorldCache _cache;
|
||||
|
||||
public WorldgenDeterminismTests(WorldCache cache) => _cache = cache;
|
||||
|
||||
[Fact]
|
||||
public void SameSeed_ProducesIdenticalElevation()
|
||||
{
|
||||
var h1 = _cache.Get(TestSeed, variant: 0).World.HashElevation();
|
||||
var h2 = _cache.Get(TestSeed, variant: 1).World.HashElevation();
|
||||
Assert.Equal(h1, h2);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SameSeed_ProducesIdenticalMoisture()
|
||||
{
|
||||
var h1 = _cache.Get(TestSeed, variant: 0).World.HashMoisture();
|
||||
var h2 = _cache.Get(TestSeed, variant: 1).World.HashMoisture();
|
||||
Assert.Equal(h1, h2);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SameSeed_ProducesIdenticalTemperature()
|
||||
{
|
||||
var h1 = _cache.Get(TestSeed, variant: 0).World.HashTemperature();
|
||||
var h2 = _cache.Get(TestSeed, variant: 1).World.HashTemperature();
|
||||
Assert.Equal(h1, h2);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SameSeed_ProducesIdenticalBiomes()
|
||||
{
|
||||
var h1 = _cache.Get(TestSeed, variant: 0).World.HashBiomes();
|
||||
var h2 = _cache.Get(TestSeed, variant: 1).World.HashBiomes();
|
||||
Assert.Equal(h1, h2);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void DifferentSeeds_ProduceDifferentElevation()
|
||||
{
|
||||
var h1 = _cache.Get(TestSeed).World.HashElevation();
|
||||
var h2 = _cache.Get(TestSeed + 1).World.HashElevation();
|
||||
Assert.NotEqual(h1, h2);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user