From: Ian Jackson Date: Fri, 9 Jul 2021 17:58:17 +0000 (+0100) Subject: jstest: lower: implement a test X-Git-Tag: otter-0.7.2~200 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=f1cf80b43853f169556eda294cfbc86065a0e197;p=otter.git jstest: lower: implement a test Signed-off-by: Ian Jackson --- 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