fix a logic bug in small_bitv.set

This commit is contained in:
Gareth Daniel Smith 2012-08-21 19:41:29 +01:00
parent 9423302c82
commit 5ccd299b15

View File

@ -61,7 +61,7 @@ struct small_bitv {
self.bits |= 1<<i;
}
else {
self.bits &= !(i as u32);
self.bits &= !(1<<i as u32);
}
}
#[inline(always)]
@ -456,6 +456,14 @@ mod tests {
assert act.eq_vec(~[1u]);
}
#[test]
fn test_2_elements() {
let b = bitv::bitv(2, false);
b.set(0, true);
b.set(1, false);
assert b.to_str() == ~"10";
}
#[test]
fn test_10_elements() {
let mut act;