From f1cf80b43853f169556eda294cfbc86065a0e197 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Fri, 9 Jul 2021 18:58:17 +0100 Subject: [PATCH] jstest: lower: implement a test Signed-off-by: Ian Jackson --- jstest/jst-lower.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/jstest/jst-lower.rs b/jstest/jst-lower.rs index dae32af0..5a9548be 100644 --- a/jstest/jst-lower.rs +++ b/jstest/jst-lower.rs @@ -131,6 +131,26 @@ impl Test { } // no bottom are newly above non-bottom + { + let misbottom = |on: &[&PieceCollated]| { + let mut misbottom = HashSet::new(); + for i in 0..on.len() { + for j in i+1..on.len() { + // j is above i + if on[j].bottom && ! on[i].bottom { + // bottom above non-bottom + misbottom.insert((on[j].id, on[i].id)); + } + } + } + misbottom + }; + let old = misbottom(&old); + let new = misbottom(&new); + let newly = new.difference(&old).collect_vec(); + assert!( newly.is_empty(), "{:?}", &newly ); + } + // no non-bottom non-targets moved // z coords (at least of bottom) in updates all decrease // all targets now below all non-bottom non-targets -- 2.30.2