Fix the each_storage() iterator on big bit vectors

This commit is contained in:
Alex Crichton 2013-02-04 11:14:33 -05:00
parent 9556629da2
commit 406a73fde2

View File

@ -156,7 +156,7 @@ impl BigBitv {
fn each_storage(op: fn(v: &mut uint) -> bool) {
for uint::range(0, self.storage.len()) |i| {
let mut w = self.storage[i];
let b = !op(&mut w);
let b = op(&mut w);
self.storage[i] = w;
if !b { break; }
}
@ -981,6 +981,24 @@ mod tests {
assert !b1[40];
assert !b1[80];
}
#[test]
pub fn test_small_clear() {
let b = Bitv(14, true);
b.clear();
for b.ones |i| {
die!(fmt!("found 1 at %?", i));
}
}
#[test]
pub fn test_big_clear() {
let b = Bitv(140, true);
b.clear();
for b.ones |i| {
die!(fmt!("found 1 at %?", i));
}
}
}
//