From 2f3cff28067000c46c44ed05400786bb400e937c Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Wed, 23 May 2012 20:29:46 -0700 Subject: [PATCH] bench: Remove 99bob benchmarks --- src/test/bench/99bob-iter.rs | 57 --------------------------------- src/test/bench/99bob-pattern.rs | 57 --------------------------------- src/test/bench/99bob-simple.rs | 53 ------------------------------ src/test/bench/99bob-tail.rs | 39 ---------------------- 4 files changed, 206 deletions(-) delete mode 100644 src/test/bench/99bob-iter.rs delete mode 100644 src/test/bench/99bob-pattern.rs delete mode 100644 src/test/bench/99bob-simple.rs delete mode 100644 src/test/bench/99bob-tail.rs diff --git a/src/test/bench/99bob-iter.rs b/src/test/bench/99bob-iter.rs deleted file mode 100644 index 46b718a85c7..00000000000 --- a/src/test/bench/99bob-iter.rs +++ /dev/null @@ -1,57 +0,0 @@ - - -/* -*- mode::rust;indent-tabs-mode::nil -*- - * Implementation of 99 Bottles of Beer - * http://99-bottles-of-beer.net/ - */ -use std; -import int; -import str; - -fn b1() -> str { ret "# of beer on the wall, # of beer."; } - -fn b2() -> str { - ret "Take one down and pass it around, # of beer on the wall."; -} - -fn b7() -> str { - ret "No more bottles of beer on the wall, no more bottles of beer."; -} - -fn b8() -> str { - ret "Go to the store and buy some more, # of beer on the wall."; -} - -fn sub(t: str, n: int) -> str unsafe { - let mut b: str = ""; - let mut i: uint = 0u; - let mut ns: str; - alt n { - 0 { ns = "no more bottles"; } - 1 { ns = "1 bottle"; } - _ { ns = int::to_str(n, 10u) + " bottles"; } - } - while i < str::len(t) { - if t[i] == '#' as u8 { b += ns; } - else { str::unsafe::push_byte(b, t[i]); } - i += 1u; - } - ret b; -} - - -/* Using an interator */ -fn ninetynine(it: fn(int)) { - let mut n: int = 100; - while n > 1 { n -= 1; it(n); } -} - -fn main() { - ninetynine {|n| - log(debug, sub(b1(), n)); - log(debug, sub(b2(), n - 1)); - #debug(""); - }; - log(debug, b7()); - log(debug, b8()); -} diff --git a/src/test/bench/99bob-pattern.rs b/src/test/bench/99bob-pattern.rs deleted file mode 100644 index a2a1c00b75d..00000000000 --- a/src/test/bench/99bob-pattern.rs +++ /dev/null @@ -1,57 +0,0 @@ - - -/* -*- mode::rust;indent-tabs-mode::nil -*- - * Implementation of 99 Bottles of Beer - * http://99-bottles-of-beer.net/ - */ -use std; -import int; -import str; - -enum bottle { none, dual, single, multiple(int), } - -fn show(b: bottle) { - alt b { - none { - #debug("No more bottles of beer on the wall, \ - no more bottles of beer,"); - #debug("Go to the store and buy some more, \ - 99 bottles of beer on the wall."); - } - single { - #debug("1 bottle of beer on the wall, 1 bottle of beer,"); - #debug("Take one down and pass it around, \ - no more bottles of beer on the wall."); - } - dual { - #debug("2 bottles of beer on the wall, 2 bottles of beer,"); - #debug("Take one down and pass it around, \ - 1 bottle of beer on the wall."); - } - multiple(n) { - #debug("%d bottles of beer on the wall, %d bottles of beer,", n, n); - #debug("Take one down and pass it around, \ - %d bottles of beer on the wall.", n-1); - } - } -} - -fn next(b: bottle) -> bottle { - alt b { - none { ret none; } - single { ret none; } - dual { ret single; } - multiple(3) { ret dual; } - multiple(n) { ret multiple(n - 1); } - } -} - - -// Won't need this when tags can be compared with == -fn more(b: bottle) -> bool { alt b { none { ret false; } _ { ret true; } } } - -fn main() { - let mut b: bottle = multiple(99); - let mut running: bool = true; - while running { show(b); #debug(""); running = more(b); b = next(b); } -} diff --git a/src/test/bench/99bob-simple.rs b/src/test/bench/99bob-simple.rs deleted file mode 100644 index 2fa2b6cb18e..00000000000 --- a/src/test/bench/99bob-simple.rs +++ /dev/null @@ -1,53 +0,0 @@ - - -/* -*- mode::rust;indent-tabs-mode::nil -*- - * Implementation of 99 Bottles of Beer - * http://99-bottles-of-beer.net/ - */ -use std; -import int; -import str; - -fn b1() -> str { ret "# of beer on the wall, # of beer."; } - -fn b2() -> str { - ret "Take one down and pass it around, # of beer on the wall."; -} - -fn b7() -> str { - ret "No more bottles of beer on the wall, no more bottles of beer."; -} - -fn b8() -> str { - ret "Go to the store and buy some more, # of beer on the wall."; -} - -fn sub(t: str, n: int) -> str unsafe { - let mut b: str = ""; - let mut i: uint = 0u; - let mut ns: str; - alt n { - 0 { ns = "no more bottles"; } - 1 { ns = "1 bottle"; } - _ { ns = int::to_str(n, 10u) + " bottles"; } - } - while i < str::len(t) { - if t[i] == '#' as u8 { b += ns; } - else { str::unsafe::push_byte(b, t[i]); } - i += 1u; - } - ret b; -} - - -/* Straightforward counter */ -fn main() { - let mut n: int = 99; - while n > 0 { - log(debug, sub(b1(), n)); - log(debug, sub(b2(), n - 1)); - #debug(""); n -= 1; - } - log(debug, b7()); - log(debug, sub(b8(), 99)); -} diff --git a/src/test/bench/99bob-tail.rs b/src/test/bench/99bob-tail.rs deleted file mode 100644 index ccd6b6ca098..00000000000 --- a/src/test/bench/99bob-tail.rs +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- mode::rust;indent-tabs-mode::nil -*- - * Implementation of 99 Bottles of Beer - * http://99-bottles-of-beer.net/ - */ -use std; -import int; -import str; - -fn main() { - fn multiple(n: int) { - #debug("%d bottles of beer on the wall, %d bottles of beer,", n, n); - #debug("Take one down and pass it around, %d \ - bottles of beer on the wall.", n-1); - #debug(""); - if n > 3 { ret multiple(n - 1); } else { ret dual(); } - } - fn dual() { - #debug("2 bottles of beer on the wall, 2 bottles of beer,"); - #debug("Take one down and pass it around, \ - 1 bottle of beer on the wall."); - #debug(""); - ret single(); - } - fn single() { - #debug("1 bottle of beer on the wall, 1 bottle of beer,"); - #debug("Take one down and pass it around, \ - no more bottles of beer on the wall."); - #debug(""); - ret none(); - } - fn none() { - #debug("No more bottles of beer on the wall, \ - no more bottles of beer,"); - #debug("Go to the store and buy some more, \ - 99 bottles of beer on the wall."); - #debug(""); - } - multiple(99); -}