about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCarol W <carolcode@willingconsulting.com>2013-11-10 13:42:21 -0800
committerCarol Willing <carolcode@willingconsulting.com>2013-11-12 15:14:07 -0800
commit33ee4335b97947dca1efc3fbc833eba60d842164 (patch)
tree7993bc3fdf8e1a9f2c54da21ae9df715fafc9892
parent3b0d48634f546055e17cf23a6bcde1bbfbc16b15 (diff)
downloadrust-33ee4335b97947dca1efc3fbc833eba60d842164.tar.gz
rust-33ee4335b97947dca1efc3fbc833eba60d842164.zip
Fixed xfail for nbody shootout benchmark by correcting command line parse.
Cleaned up unneeded imports and type changes to resolve compiler warnings.
-rw-r--r--src/test/bench/shootout-ackermann.rs1
-rw-r--r--src/test/bench/shootout-chameneos-redux.rs1
-rw-r--r--src/test/bench/shootout-fibo.rs1
-rw-r--r--src/test/bench/shootout-nbody.rs19
4 files changed, 13 insertions, 9 deletions
diff --git a/src/test/bench/shootout-ackermann.rs b/src/test/bench/shootout-ackermann.rs
index 9183bd5551a..a7f86b01b3f 100644
--- a/src/test/bench/shootout-ackermann.rs
+++ b/src/test/bench/shootout-ackermann.rs
@@ -10,7 +10,6 @@
 
 extern mod extra;
 
-use std::int;
 use std::os;
 
 fn ack(m: int, n: int) -> int {
diff --git a/src/test/bench/shootout-chameneos-redux.rs b/src/test/bench/shootout-chameneos-redux.rs
index 6bfb731badd..a489d17e92a 100644
--- a/src/test/bench/shootout-chameneos-redux.rs
+++ b/src/test/bench/shootout-chameneos-redux.rs
@@ -17,7 +17,6 @@ use std::comm::{stream, SharedChan};
 use std::option;
 use std::os;
 use std::task;
-use std::uint;
 
 fn print_complements() {
     let all = [Blue, Red, Yellow];
diff --git a/src/test/bench/shootout-fibo.rs b/src/test/bench/shootout-fibo.rs
index 616ec3fa694..d7a9dd86f4d 100644
--- a/src/test/bench/shootout-fibo.rs
+++ b/src/test/bench/shootout-fibo.rs
@@ -10,7 +10,6 @@
 
 extern mod extra;
 
-use std::int;
 use std::os;
 
 fn fib(n: int) -> int {
diff --git a/src/test/bench/shootout-nbody.rs b/src/test/bench/shootout-nbody.rs
index ab5c7377bd8..733269f2a5f 100644
--- a/src/test/bench/shootout-nbody.rs
+++ b/src/test/bench/shootout-nbody.rs
@@ -1,6 +1,3 @@
-// xfail-test reading from os::args()[1] - bogus!
-
-use std::from_str::FromStr;
 use std::os;
 
 static PI: f64 = 3.141592653589793;
@@ -139,13 +136,23 @@ fn offset_momentum(bodies: &mut [Planet, ..N_BODIES]) {
 }
 
 fn main() {
-    let n: i32 = FromStr::from_str(os::args()[1]).unwrap();
+    let args = os::args();
+    let args = if os::getenv("RUST_BENCH").is_some() {
+        ~[~"", ~"1000"]
+    } else if args.len() <= 1u {
+        ~[~"", ~"1000"]
+    } else {
+        args
+    };
+
+    let n: i32 = from_str::<i32>(args[1]).unwrap();
     let mut bodies = BODIES;
 
     offset_momentum(&mut bodies);
-    println!("{:.9f}", energy(&bodies) as float);
+    println!("{:.9f}", energy(&bodies) as f64);
 
     advance(&mut bodies, 0.01, n);
 
-    println!("{:.9f}", energy(&bodies) as float);
+    println!("{:.9f}", energy(&bodies) as f64);
 }
+