| 1 | //! How far seeded sweeps reach. By default each runs its smoke slice; `SNOWBOUND_SWEEP=n` |
| 2 | //! runs every sweep in full with its seeds shifted by `n` (`0` for the seeds as written), and |
| 3 | //! a failure replays under the same value. |
| 4 | #![allow(dead_code)] |
| 5 | |
| 6 | use std::ops::Range; |
| 7 | |
| 8 | /// The shift `SNOWBOUND_SWEEP` asks full sweeps to run with. |
| 9 | pub fn full() -> Option<u64> { |
| 10 | let shift = std::env::var("SNOWBOUND_SWEEP").ok()?; |
| 11 | Some(shift.parse().expect("SNOWBOUND_SWEEP is a seed shift")) |
| 12 | } |
| 13 | |
| 14 | /// The seeds of `all` a sweep runs: its first `smoke`, or all of them shifted. |
| 15 | pub fn seeds(all: Range<u64>, smoke: u64) -> Range<u64> { |
| 16 | match full() { |
| 17 | None => all.start..all.end.min(all.start + smoke), |
| 18 | Some(shift) => all.start + shift..all.end + shift, |
| 19 | } |
| 20 | } |