From 253f1eecc2d652a33fc9bb8bd3c56721b0681574 Mon Sep 17 00:00:00 2001 From: Frotty Date: Mon, 17 Aug 2026 17:35:17 +0200 Subject: [PATCH] Query every benchmark point once instead of nine times benchmarkPoint strides by 73 and 151 modulo 1152, and both strides are coprime to 1152, so the sequence has period 1152: an index past that repeats a point already queried. Iterating to 9999 asked the same 1152 questions nearly nine times over. That bought no coverage and cost enough interpreted work to reach the twenty second test budget, so the test failed as a timeout on a loaded machine while saying nothing about the polygon. One full period queries every point the helper can produce, and both aggregate assertions compare totals which scale with the iteration count, so they hold unchanged. --- wurst/math/PolygonTests.wurst | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/wurst/math/PolygonTests.wurst b/wurst/math/PolygonTests.wurst index 613850f1..15730608 100644 --- a/wurst/math/PolygonTests.wurst +++ b/wurst/math/PolygonTests.wurst @@ -179,12 +179,17 @@ function benchmarkPoint(int index) returns vec2 (polygon.classify(vec2(96, 96)) == polygon.classifyLinear(vec2(96, 96))).assertTrue() destroy polygon -@Test function acceleratedClassificationMatchesLinearFor10000Points() +/** Every point benchmarkPoint can produce, which is fewer than it looks. + Both strides are coprime to 1152, so the sequence has period 1152 and an index past that + repeats a point already queried. Ten thousand iterations asked the same 1152 questions + nearly nine times over, for no coverage and enough interpreted work to reach the + twenty second test budget on a loaded machine. */ +@Test function acceleratedClassificationMatchesLinearForEveryBenchmarkPoint() let polygon = benchmarkPolygon() var totalCandidates = 0 var linearEdges = 0 var mixedQueries = 0 - for i = 0 to 9999 + for i = 0 to 1151 let point = benchmarkPoint(i) (polygon.classify(point) == polygon.classifyLinear(point)).assertTrue() if point.x >= 0 and point.x <= 1024 and point.y >= 0 and point.y <= 1024 @@ -195,7 +200,7 @@ function benchmarkPoint(int index) returns vec2 mixedQueries++ totalCandidates += candidates totalCandidates.assertLessThan(linearEdges) - print("Polygon 10000-lookups: mixed=" + mixedQueries + + print("Polygon 1152-lookups: mixed=" + mixedQueries + ", linearEdges=" + linearEdges + ", candidateEdges=" + totalCandidates) destroy polygon