Skip to content

Commit

Permalink
add a test for the chunk function
Browse files Browse the repository at this point in the history
  • Loading branch information
thestinger committed Mar 16, 2013
1 parent 0942c80 commit d856215
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/libcore/trie.rs
Original file line number Diff line number Diff line change
Expand Up @@ -469,4 +469,26 @@ mod tests {
n -= 1;
}
}

#[test]
fn test_sane_chunk() {
let x = 1;
let y = 1 << (uint::bits - 1);

let mut trie = TrieSet::new();

fail_unless!(trie.insert(x));
fail_unless!(trie.insert(y));

fail_unless!(trie.len() == 2);

let expected = [x, y];

let mut i = 0;

for trie.each |x| {
fail_unless!(expected[i] == *x);
i += 1;
}
}
}

5 comments on commit d856215

@bors
Copy link
Contributor

@bors bors commented on d856215 Mar 16, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on d856215 Mar 16, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging thestinger/rust/trie = d856215 into auto

@bors
Copy link
Contributor

@bors bors commented on d856215 Mar 16, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thestinger/rust/trie = d856215 merged ok, testing candidate = ebba8b4

@bors
Copy link
Contributor

@bors bors commented on d856215 Mar 16, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on d856215 Mar 16, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding incoming to auto = ebba8b4

Please sign in to comment.