fix a logic bug in small_bitv.set
This commit is contained in:
parent
9423302c82
commit
5ccd299b15
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user