From 40c08c2d12ebfb8d0a56e9bc2f71b72460cfff0c Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Mon, 26 Oct 2026 00:38:47 +0100 Subject: [PATCH] streaming: check every fourth cell of the cover test in debug builds the_grid_answers_as_the_scan compared the grid with the scan on every cell of 60 cases and took 20 of the ~30 s of `cargo test -p horizon-client` on the ThinkPad. A debug build now checks every fourth cell of each row, shifted by row and case, so the cases together still meet every cell position relative to the areas; a release build checks every cell. Co-Authored-By: Claude Opus 5.5 --- crates/horizon-client/src/streaming.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/crates/horizon-client/src/streaming.rs b/crates/horizon-client/src/streaming.rs index 55a2f0086..13b19fefc 100644 --- a/crates/horizon-client/src/streaming.rs +++ b/crates/horizon-client/src/streaming.rs @@ -2148,8 +2148,13 @@ mod cover_tests { } /// Every question streaming asks gets the same answer with the grid. + /// + /// A debug build checks every fourth cell of each row, shifted by row and case so the cases still cover every + /// cell's position relative to the areas: the full check took 20 of the ~30 s of the crate's tests. + /// `cargo test --release -p horizon-client --lib the_grid_answers_as_the_scan` checks every cell. #[test] fn the_grid_answers_as_the_scan() { + let stride = if cfg!(debug_assertions) { 4 } else { 1 }; let mut seed = 0x9E37_79B9_7F4A_7C15u64; let forced: HashSet<(i32, i32)> = [(40, -40)].into(); for case in 0..60 { @@ -2165,7 +2170,8 @@ mod cover_tests { let (scan, grid) = (ranges(None), ranges(Some(&cover))); let span = [4, 30, 120][case % 3] + 40; for z in -span..=span { - for x in -span..=span { + let first = -span + (z + case as i32).rem_euclid(stride); + for x in (first..=span).step_by(stride as usize) { for m in 0..=ExtraCover::REACH + 2 { assert_eq!( scan.in_extra(x, z, m),