diff --git a/packages/cultmath/tests/CultMath.Tests/SiteCellsTests.cs b/packages/cultmath/tests/CultMath.Tests/SiteCellsTests.cs index 5feda04d..f1eec1ff 100644 --- a/packages/cultmath/tests/CultMath.Tests/SiteCellsTests.cs +++ b/packages/cultmath/tests/CultMath.Tests/SiteCellsTests.cs @@ -461,10 +461,19 @@ public sealed class SiteCellsTests Assert.Equal("p", Assert.Throws(() => power_border(query, new[] { good })).ParamName); } - // Indices are floats, exact only to 2^24: a longer span is refused before any site is read. - var one = new[] { good }; - Assert.Equal("sites", Assert.Throws(() => power_cells(origin, System.Runtime.InteropServices.MemoryMarshal.CreateReadOnlySpan(ref one[0], (1 << 24) + 1))).ParamName); - Assert.Equal("sites", Assert.Throws(() => multiplicative_cells(origin, System.Runtime.InteropServices.MemoryMarshal.CreateReadOnlySpan(ref one[0], (1 << 24) + 1))).ParamName); + // Indices are floats, exact only to 2^24: a span of 2^24 + 1 real sites is refused for its length. + var overlong = new float4[(1 << 24) + 1]; + foreach (var call in new Func[] + { + () => Assert.Throws(() => power_cells(origin, overlong)), + () => Assert.Throws(() => multiplicative_cells(origin, overlong)), + () => Assert.Throws(() => power_border(origin, overlong)), + }) + { + var e = call(); + Assert.Equal("sites", e.ParamName); + Assert.Contains("2^24", e.Message); + } } [Fact]