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

This commit is contained in:
Patrick Walton 2013-03-14 11:22:14 -07:00
parent 1c8490b0d9
commit da9c6d9ba6
6 changed files with 15 additions and 7 deletions

View File

@ -17,6 +17,7 @@
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 File

@ -29,6 +29,7 @@
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 @@
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 File

@ -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 File

@ -57,7 +57,11 @@ fn bisect(v: ~[AminoAcids], lo: uint, hi: uint, target: u32) -> 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 File

@ -110,7 +110,7 @@ fn get_type(&self) -> io::WriterType { io::File }
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 File

@ -39,7 +39,7 @@
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 @@ fn drop_color(g: grid, mut colors: bitv::Bitv, row: u8, col: u8) {
}
}
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| {