Browse files

test: Remove deprecated features from benchmark tests. rs=burningtree

  • Loading branch information...
1 parent 1c8490b commit da9c6d9ba6982d3027e81663fd1daabc8da567a8 @pcwalton pcwalton committed Mar 14, 2013
View
1 src/test/bench/core-std.rs
@@ -17,6 +17,7 @@ use std::oldmap;
use std::oldmap::{Map, HashMap};
use core::io::{Reader, ReaderUtil};
+use core::rand::RngUtil;
macro_rules! bench (
($id:ident) => (maybe_run_test(argv, stringify!($id).to_owned(), $id))
View
3 src/test/bench/graph500-bfs.rs
@@ -29,6 +29,7 @@ use std::deque::Deque;
use std::par;
use core::io::WriterUtil;
use core::int::abs;
+use core::rand::RngUtil;
type node_id = i64;
type graph = ~[~[node_id]];
@@ -37,7 +38,7 @@ type bfs_result = ~[node_id];
fn make_edges(scale: uint, edgefactor: uint) -> ~[(node_id, node_id)] {
let r = rand::xorshift();
- fn choose_edge(i: node_id, j: node_id, scale: uint, r: rand::Rng)
+ fn choose_edge(i: node_id, j: node_id, scale: uint, r: @rand::Rng)
-> (node_id, node_id) {
let A = 0.57;
View
4 src/test/bench/noise.rs
@@ -1,5 +1,7 @@
// Perlin noise benchmark from https://gist.github.com/1170424
+use core::rand::RngUtil;
+
struct Vec2 {
x: f32,
y: f32,
@@ -8,7 +10,7 @@ struct Vec2 {
fn lerp(a: f32, b: f32, v: f32) -> f32 { a * (1.0 - v) + b * v }
fn smooth(v: f32) -> f32 { v * v * (3.0 - 2.0 * v) }
-fn random_gradient(r: rand::Rng) -> Vec2 {
+fn random_gradient(r: @rand::Rng) -> Vec2 {
let v = r.gen_float() * float::consts::pi * 2.0;
Vec2{
x: float::cos(v) as f32,
View
8 src/test/bench/shootout-fasta.rs
@@ -57,7 +57,11 @@ fn select_random(r: u32, genelist: ~[AminoAcids]) -> char {
return bisect(copy genelist, 0, vec::len::<AminoAcids>(genelist) - 1, r);
}
-fn make_random_fasta(wr: io::Writer, id: ~str, desc: ~str, genelist: ~[AminoAcids], n: int) {
+fn make_random_fasta(wr: @io::Writer,
+ id: ~str,
+ desc: ~str,
+ genelist: ~[AminoAcids],
+ n: int) {
wr.write_line(~">" + id + ~" " + desc);
let rng = @mut MyRandom {last: rand::Rng().next()};
let mut op: ~str = ~"";
@@ -72,7 +76,7 @@ fn make_random_fasta(wr: io::Writer, id: ~str, desc: ~str, genelist: ~[AminoAcid
if str::len(op) > 0u { wr.write_line(op); }
}
-fn make_repeat_fasta(wr: io::Writer, id: ~str, desc: ~str, s: ~str, n: int) {
+fn make_repeat_fasta(wr: @io::Writer, id: ~str, desc: ~str, s: ~str, n: int) {
unsafe {
wr.write_line(~">" + id + ~" " + desc);
let mut op: ~str = ~"";
View
2 src/test/bench/shootout-mandelbrot.rs
@@ -110,7 +110,7 @@ impl io::Writer for Devnull {
fn writer(path: ~str, pport: comm::Port<Line>, size: uint)
{
- let cout: io::Writer = match path {
+ let cout: @io::Writer = match path {
~"" => {
@Devnull as @io::Writer
}
View
4 src/test/bench/sudoku.rs
@@ -39,7 +39,7 @@ type grid = ~[~[u8]];
pub enum grid_t { grid_ctor(grid), }
// read a sudoku problem from file f
-pub fn read_grid(f: io::Reader) -> grid_t {
+pub fn read_grid(f: @io::Reader) -> grid_t {
fail_unless!(f.read_line() == ~"9,9"); /* assert first line is exactly "9,9" */
let mut g = vec::from_fn(10u, {|_i|
@@ -127,7 +127,7 @@ pub fn solve_grid(g: grid_t) {
}
}
-pub fn write_grid(f: io::Writer, g: grid_t) {
+pub fn write_grid(f: @io::Writer, g: grid_t) {
for u8::range(0u8, 9u8) |row| {
f.write_str(fmt!("%u", (*g)[row][0] as uint));
for u8::range(1u8, 9u8) |col| {

0 comments on commit da9c6d9

Please sign in to comment.