chiark / gitweb /
hidden: Add checks for un-notched to vpid::consistency_check
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 25 Apr 2022 00:26:28 +0000 (01:26 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 25 Apr 2022 00:31:17 +0000 (01:31 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/vpid.rs

index cbc433a5016203838e1214d092b451089025f321..a1785839a4e7087b056fcbb58ecb7d1777d0845b 100644 (file)
@@ -405,6 +405,8 @@ pub fn consistency_check(
       let occ = goccults.occults.get(occid).unwrap();
       if let Some(notch) = permute_notch {
         assert_eq!(occ.notches.table[notch], NR::Piece(piece));
+      } else {
+        assert!(occ.unnotched.contains(&piece));
       }
     }
   }
@@ -438,6 +440,11 @@ pub fn consistency_check(
       walk = next;
     }
     assert_eq!(nfree1,  nfree2);
+
+    for &ppiece in &occ.unnotched {
+      assert_eq!(gpieces.get(ppiece).unwrap().occult.passive,
+                 Some(Passive { occid, permute_notch: None }));
+    }
   }
 }