mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-31 14:31:55 +00:00
auto merge of #5569 : thestinger/rust/map, r=catamorphism
This commit is contained in:
commit
30b1957cd4
@ -49,19 +49,19 @@ fn descending<M: Map<uint, uint>>(map: &mut M, n_keys: uint) {
|
|||||||
io::println(" Descending integers:");
|
io::println(" Descending integers:");
|
||||||
|
|
||||||
do timed("insert") {
|
do timed("insert") {
|
||||||
for uint::range(0, n_keys) |i| {
|
for uint::range_rev(n_keys, 0) |i| {
|
||||||
map.insert(i, i + 1);
|
map.insert(i, i + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
do timed("search") {
|
do timed("search") {
|
||||||
for uint::range(0, n_keys) |i| {
|
for uint::range_rev(n_keys, 0) |i| {
|
||||||
fail_unless!(map.find(&i).unwrap() == &(i + 1));
|
fail_unless!(map.find(&i).unwrap() == &(i + 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
do timed("remove") {
|
do timed("remove") {
|
||||||
for uint::range(0, n_keys) |i| {
|
for uint::range_rev(n_keys, 0) |i| {
|
||||||
fail_unless!(map.remove(&i));
|
fail_unless!(map.remove(&i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user