Skip to content

Commit 9c21673

Browse files
committed
bench: Update shootout-binarytrees for style
1 parent c53d0a0 commit 9c21673

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

src/test/bench/shootout-binarytrees.rs

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,22 @@ fn bottom_up_tree(item: int, depth: int) -> ~tree {
1919
} else { ret ~nil; }
2020
}
2121

22-
fn main() {
23-
let n = 8;
22+
fn main(args: [str]) {
23+
let n = if vec::len(args) == 2u {
24+
int::from_str(args[1])
25+
} else {
26+
15
27+
};
2428
let min_depth = 4;
2529
let max_depth;
2630
if min_depth + 2 > n {
2731
max_depth = min_depth + 2;
2832
} else { max_depth = n; }
2933
let stretch_depth = max_depth + 1;
3034
let stretch_tree = bottom_up_tree(0, stretch_depth);
31-
#debug("stretch tree of depth %d\t check: %d", stretch_depth,
32-
item_check(stretch_tree));
35+
std::io::println(#fmt("stretch tree of depth %d\t check: %d",
36+
stretch_depth,
37+
item_check(stretch_tree)));
3338
let long_lived_tree = bottom_up_tree(0, max_depth);
3439
let depth = min_depth;
3540
while depth <= max_depth {
@@ -43,10 +48,12 @@ fn main() {
4348
chk += item_check(temp_tree);
4449
i += 1;
4550
}
46-
#debug("%d\t trees of depth %d\t check: %d", iterations * 2, depth,
47-
chk);
51+
std::io::println(#fmt("%d\t trees of depth %d\t check: %d",
52+
iterations * 2, depth,
53+
chk));
4854
depth += 2;
4955
}
50-
#debug("long lived trees of depth %d\t check: %d", max_depth,
51-
item_check(long_lived_tree));
56+
std::io::println(#fmt("long lived trees of depth %d\t check: %d",
57+
max_depth,
58+
item_check(long_lived_tree)));
5259
}

0 commit comments

Comments
 (0)