using Theriapolis.Core.World.Generation; using Theriapolis.Core.World.Generation.Stages; using Xunit; namespace Theriapolis.Tests.Worldgen; /// /// Addendum A §1: the coastline must have organic noise-based shape across a /// range of seeds after the BorderDistortionGen stage runs. /// /// The validator counts maximal runs of consecutive border tiles in four line /// orientations (horizontal, vertical, both diagonals). Any run longer than /// tiles is a /// violation — this catches both axis-aligned and diagonal ruler-straight /// coasts, which the previous cardinal-only 3-run detector missed. /// public sealed class BorderOrganicsTests : IClassFixture { private readonly WorldCache _cache; public BorderOrganicsTests(WorldCache cache) => _cache = cache; private int ViolationsForSeed(ulong seed) { var ctx = _cache.Get(seed); return BorderDistortionGenStage.CountStraightViolations(ctx); } [Fact] public void Seed_CAFEBABE_HasZeroStraightViolations() { Assert.Equal(0, ViolationsForSeed(0xCAFEBABEUL)); } [Theory] [InlineData(1UL)] [InlineData(42UL)] [InlineData(999UL)] [InlineData(0xDEAD_BEEFUL)] [InlineData(0x1234_5678UL)] [InlineData(0xABCD_EF01UL)] [InlineData(7777777UL)] [InlineData(0xFF00_FF00UL)] [InlineData(314159265UL)] [InlineData(271828182UL)] public void TenSeeds_HaveZeroStraightViolations(ulong seed) { Assert.Equal(0, ViolationsForSeed(seed)); } }