chiark / gitweb /
prep for dec tests
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 10 Oct 2020 23:03:16 +0000 (00:03 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 10 Oct 2020 23:03:16 +0000 (00:03 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
zcoord/zcoord.rs

index 3fc7a0f0225351a2d5576829881d8592fd3283fd..a5871db61cc8b15e4fd2c5b84de4dd15894554e8 100644 (file)
@@ -503,11 +503,13 @@ mod test {
   fn addition() {
     fn mk(s: &str) -> super::Mutable { bf(s).clone_mut() }
     impl Mutable {
-      fn tinc(mut self, exp: &str) -> Self {
-        let got = self.increment().unwrap();
+      fn tincdec(mut self, exp: &str, id: IncDecOffset) -> Self {
+        let got = self.incdec(id).unwrap();
         assert_eq!(got.to_string(), exp);
         self
       }
+      fn tinc(mut self, exp: &str) -> Self { self.tincdec(exp, IncDecInc) }
+      fn tdec(mut self, exp: &str) -> Self { self.tincdec(exp, IncDecDec) }
     }
     mk("000000000a")
       .tinc("000100000a")
@@ -519,5 +521,20 @@ mod test {
     mk("vvvvvvvvvv_vvvvvvvvvv_vvvvv01234")
       .tinc("vvvvvvvvvv_vvvvvvvvvv_vvvvv01234_0000000000_0001000000")
       ;
+
+    mk("000000000a")
+      .tinc("000100000a")
+      .tinc("000200000a")
+      ;
+    mk("vvvvvvvvvv")
+      .tinc("vvvvvvvvvv_0000000000_0001000000")
+      ;
+    mk("vvvvvvvvvv_vvvvvvvvvv_vvvvv01234")
+      .tinc("vvvvvvvvvv_vvvvvvvvvv_vvvvv01234_0000000000_0001000000")
+      ;
+    mk("000000000a")
+      .tinc("000100000a")
+      .tinc("000200000a")
+      ;
   }
 }