chiark / gitweb /
jstest: lower: implement a test
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 9 Jul 2021 17:58:17 +0000 (18:58 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 9 Jul 2021 17:58:17 +0000 (18:58 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
jstest/jst-lower.rs

index dae32af0fd2c044ce2e18262dc5ba82db13c57bf..5a9548bef8395f5af7ed1eb2d1ff631ac6e78cf4 100644 (file)
@@ -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