chiark / gitweb /
wip range tests
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 11 Oct 2020 00:14:10 +0000 (01:14 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 11 Oct 2020 00:14:10 +0000 (01:14 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
templates/bigfloat-tests.ts
zcoord/zcoord.rs

index d2c50cbd14e2c4a4021d8d26d00ec90c137ce96e..68ee3a3935bf0cb2309e06ec2eb029723ef685b3 100644 (file)
@@ -13,14 +13,6 @@ let x : any;
 let y : any
 let i : any
 
-x = "!0000 ffff_ffff_fff0" as any;
-y = "!0000 0000_0000_0040" as any;
-i = Bigfloats.iter_upto(x, y, 4);
-
-assert_eq(i(), "+0000 0000_0000_0000");
-assert_eq(i(), "+0000 0000_0000_0010");
-assert_eq(i(), "+0000 0000_0000_0020");
-assert_eq(i(), "+0000 0000_0000_0030");
 
 x = "!0000 ffff_ffff_fffe" as any;
 y = "!0000 0000_0000_0001" as any;
index 5c8f1b3b26af9656b038ac9aac3dbb17e746f7e9..d88a60106f6e7f446eb860f9daacb5ef29949a0e 100644 (file)
@@ -249,7 +249,7 @@ impl Mutable {
   }
 
   #[throws(RangeBackwards)]
-  pub fn range(&self, other: &Mutable, count: u32) -> RangeIterator {
+  pub fn range_upto(&self, other: &Mutable, count: u32) -> RangeIterator {
     Mutable::range_core(self, other, count)?.take(count as usize)
   }
 }
@@ -613,4 +613,16 @@ mod test {
       .tinc("vvvvvvvvvv_vvvvvvvvvv_vvvvv01234_0000000000_0001000000")
       ;
   }
+
+  #[test]
+  fn range(){
+    let x = bf("vvvvvvvvv0").clone_mut();
+    let y = bf("0000000040").clone_mut();
+    let mut i = x.range_upto(&y, 4).unwrap();
+    assert_eq!(i.next().unwrap().to_string(), "0000000000");
+    assert_eq!(i.next().unwrap().to_string(), "0000000010");
+    assert_eq!(i.next().unwrap().to_string(), "0000000020");
+    assert_eq!(i.next().unwrap().to_string(), "0000000030");
+    assert_eq!(i.next(), None);
+  }
 }