From fcd580a8edd504367e0af9e7f75e4fdac470c5f3 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Fri, 16 Oct 2026 19:36:01 +0200 Subject: [PATCH] SiteCellsTests: the 2^24 span refusal is tested on a real overlong span, so a doubled limit fails it The earlier version read past a one-element array and passed under the mutant by hitting a non-finite site. Co-Authored-By: Claude Opus 5.5 --- .../tests/CultMath.Tests/SiteCellsTests.cs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) 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]