diff --git a/tests/Aetheria.Shared.Tests/OreGeographyTests.cs b/tests/Aetheria.Shared.Tests/OreGeographyTests.cs index bc497e88e..20c1e9043 100644 --- a/tests/Aetheria.Shared.Tests/OreGeographyTests.cs +++ b/tests/Aetheria.Shared.Tests/OreGeographyTests.cs @@ -543,6 +543,17 @@ public sealed class OreGeographyTests : IDisposable Assert.Empty(Provinces.ExtraExits(pruned, new[] {4, 1}, 7, path)); Assert.Equal(Provinces.Regions(chain, new[] {4, 1}, 7), Provinces.Regions(pruned, new[] {4, 1}, 7)); + // Crossing links come ordered by far zone whatever order the adjacency lists them in. + var shuffled = diamond.Select(next => next.Reverse().ToArray()).ToArray(); + Assert.Equal(new[] {4, 3, 1}, shuffled[2]); + Assert.Equal(new[] {(2, 3), (2, 4)}, Provinces.CrossingLinks(shuffled, new[] {2}, 6)); + Assert.Equal(new[] {(2, 3)}, Provinces.ExtraExits(shuffled, new[] {2}, 6, new[] {0, 1, 2, 4, 5, 6})); + + // A boss zone at the start of the exit path keeps the link to its successor too. + var atStart = Graph(4, (0, 1), (0, 2), (1, 3), (2, 3)); + Assert.Equal(new[] {(0, 2)}, Provinces.ExtraExits(atStart, new[] {0}, 3, new[] {0, 1, 3})); + Assert.Equal(new[] {(0, 1)}, Provinces.ExtraExits(atStart, new[] {0}, 3, new[] {0, 2, 3})); + // A boss zone off the path, last on it, or followed by a zone it has no crossing link to has no exit to keep: it throws, naming the boss zone. foreach (var broken in new[] {new[] {0, 1, 5, 6}, new[] {0, 1, 2}, new[] {0, 1, 2, 5, 6}}) Assert.Contains("boss zone 2", Assert.Throws(() => Provinces.ExtraExits(diamond, new[] {2}, 6, broken)).Message);