Skip to content

Commit

Permalink
std: Fix bitv each() method (issue 2363)
Browse files Browse the repository at this point in the history
  • Loading branch information
bkircher committed May 27, 2012
1 parent 2c90d66 commit 360194d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/libstd/bitv.rs
Expand Up @@ -197,6 +197,7 @@ fn each(v: bitv, f: fn(bool) -> bool) {
let mut i = 0u;
while i < v.nbits {
if !f(get(v, i)) { break; }
i = i + 1u;
}
}

Expand Down Expand Up @@ -233,6 +234,15 @@ fn eq_vec(v0: bitv, v1: [uint]) -> bool {

#[cfg(test)]
mod tests {
#[test]
fn test_to_str() {
let zerolen = bitv(0u, false);
assert to_str(zerolen) == "";

let eightbits = bitv(8u, false);
assert to_str(eightbits) == "00000000";
}

#[test]
fn test_0_elements() {
let mut act;
Expand Down

0 comments on commit 360194d

Please sign in to comment.