From: Ian Jackson Date: Mon, 19 Jul 2021 01:39:13 +0000 (+0100) Subject: jst-lower: Prepare for only-z-same stress tests X-Git-Tag: otter-0.7.2~30 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=cba325cf88c1d808dcf6e166b16188ef95d33fda;p=otter.git jst-lower: Prepare for only-z-same stress tests Signed-off-by: Ian Jackson --- diff --git a/jstest/jst-lower.rs b/jstest/jst-lower.rs index fb80a186..11cef22b 100644 --- a/jstest/jst-lower.rs +++ b/jstest/jst-lower.rs @@ -371,7 +371,9 @@ impl TestsAccumulator { } #[throws(Explode)] - pub fn add_exhaustive(&mut self, zclashes: bool, n: usize) { + pub fn add_exhaustive(&mut self, nameprefix: &str, zupds: &[ZUpdateSpec]) { + let n: usize = match zupds.len() { 1 => 5, 2 => 4, _ => panic!() }; + let ids: Vec = (0..n).map( |i| format!("{}.{}", i+1, 1).try_into().unwrap() ).collect_vec(); @@ -379,8 +381,7 @@ impl TestsAccumulator { let pieces_configs = ids.iter().cloned().map(|id| { iproduct!( [false,true].iter().cloned(), - [ZUS::Auto, ZUS::GOnly].iter().cloned() - .take(if zclashes { 2 } else { 1}) + zupds.iter().cloned() ).map( move |(bottom,zupd)| { StartPieceSpec { id, @@ -401,8 +402,7 @@ impl TestsAccumulator { ).enumerate() { if targets.is_empty() { continue } let name = format!("exhaustive-{}-{:02x}", - if zclashes { "z" } else { "g" }, - ti); + nameprefix, ti); self.add_test(&name, pieces, targets)?; } } @@ -476,8 +476,8 @@ fn main() { "77.11", ])?; - ta.add_exhaustive(false, 5)?; - ta.add_exhaustive(true , 4)?; + ta.add_exhaustive("z", &[ZUS::Auto ])?; + ta.add_exhaustive("m", &[ZUS::Auto, ZUS::GOnly])?; let tests = ta.finalise()?;