Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
test: Automatically remove all ~[T] from tests.
  • Loading branch information
pcwalton authored and huonw committed Mar 21, 2014
1 parent 0b714b4 commit 579eb24
Show file tree
Hide file tree
Showing 247 changed files with 628 additions and 642 deletions.
1 change: 1 addition & 0 deletions src/test/auxiliary/anon-extern-mod-cross-crate-1.rs
Expand Up @@ -12,6 +12,7 @@

use std::libc;

use std::vec_ng::Vec;
#[link(name="rustrt")]
extern {
pub fn rust_get_test_int() -> libc::intptr_t;
Expand Down
6 changes: 3 additions & 3 deletions src/test/auxiliary/cci_class_6.rs
Expand Up @@ -10,21 +10,21 @@

pub mod kitties {
pub struct cat<U> {
priv info : ~[U],
priv info : Vec<U> ,
priv meows : uint,

how_hungry : int,
}

impl<U> cat<U> {
pub fn speak<T>(&mut self, stuff: ~[T]) {
pub fn speak<T>(&mut self, stuff: Vec<T> ) {
self.meows += stuff.len();
}

pub fn meow_count(&mut self) -> uint { self.meows }
}

pub fn cat<U>(in_x : uint, in_y : int, in_info: ~[U]) -> cat<U> {
pub fn cat<U>(in_x : uint, in_y : int, in_info: Vec<U> ) -> cat<U> {
cat {
meows: in_x,
how_hungry: in_y,
Expand Down
6 changes: 3 additions & 3 deletions src/test/auxiliary/cci_nested_lib.rs
Expand Up @@ -19,7 +19,7 @@ pub struct Entry<A,B> {

pub struct alist<A,B> {
eq_fn: extern "Rust" fn(A,A) -> bool,
data: @RefCell<~[Entry<A,B>]>,
data: @RefCell<Vec<Entry<A,B>> >,
}

pub fn alist_add<A:'static,B:'static>(lst: &alist<A,B>, k: A, v: B) {
Expand Down Expand Up @@ -47,7 +47,7 @@ pub fn new_int_alist<B:'static>() -> alist<int, B> {
fn eq_int(a: int, b: int) -> bool { a == b }
return alist {
eq_fn: eq_int,
data: @RefCell::new(~[]),
data: @RefCell::new(Vec::new()),
};
}

Expand All @@ -57,6 +57,6 @@ pub fn new_int_alist_2<B:'static>() -> alist<int, B> {
fn eq_int(a: int, b: int) -> bool { a == b }
return alist {
eq_fn: eq_int,
data: @RefCell::new(~[]),
data: @RefCell::new(Vec::new()),
};
}
2 changes: 1 addition & 1 deletion src/test/auxiliary/cci_no_inline_lib.rs
Expand Up @@ -11,7 +11,7 @@
#[crate_id="cci_no_inline_lib"];

// same as cci_iter_lib, more-or-less, but not marked inline
pub fn iter(v: ~[uint], f: |uint|) {
pub fn iter(v: Vec<uint> , f: |uint|) {
let mut i = 0u;
let n = v.len();
while i < n {
Expand Down
2 changes: 1 addition & 1 deletion src/test/auxiliary/issue-2631-a.rs
Expand Up @@ -17,7 +17,7 @@ extern crate collections;
use std::cell::RefCell;
use collections::HashMap;

pub type header_map = HashMap<~str, @RefCell<~[@~str]>>;
pub type header_map = HashMap<~str, @RefCell<vec!(@~str)>>;

// the unused ty param is necessary so this gets monomorphized
pub fn request<T>(req: &header_map) {
Expand Down
2 changes: 1 addition & 1 deletion src/test/auxiliary/issue_2723_a.rs
Expand Up @@ -8,6 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

pub unsafe fn f(xs: ~[int]) {
pub unsafe fn f(xs: Vec<int> ) {
xs.map(|_x| { unsafe fn q() { fail!(); } });
}
19 changes: 10 additions & 9 deletions src/test/bench/core-std.rs
Expand Up @@ -21,6 +21,7 @@ use std::mem::swap;
use std::os;
use std::str;
use std::slice;
use std::vec;
use std::io::File;

macro_rules! bench (
Expand Down Expand Up @@ -61,8 +62,8 @@ fn maybe_run_test(argv: &[~str], name: ~str, test: ||) {
}

fn shift_push() {
let mut v1 = slice::from_elem(30000, 1);
let mut v2 = ~[];
let mut v1 = Vec::from_elem(30000, 1);
let mut v2 = Vec::new();

while v1.len() > 0 {
v2.push(v1.shift().unwrap());
Expand All @@ -85,7 +86,7 @@ fn read_line() {
fn vec_plus() {
let mut r = rand::task_rng();

let mut v = ~[];
let mut v = Vec::new();
let mut i = 0;
while i < 1500 {
let rv = slice::from_elem(r.gen_range(0u, i + 1), i);
Expand All @@ -101,15 +102,15 @@ fn vec_plus() {
fn vec_append() {
let mut r = rand::task_rng();

let mut v = ~[];
let mut v = Vec::new();
let mut i = 0;
while i < 1500 {
let rv = slice::from_elem(r.gen_range(0u, i + 1), i);
if r.gen() {
v = slice::append(v, rv);
v = vec::append(v, rv);
}
else {
v = slice::append(rv, v);
v = vec::append(rv, v);
}
i += 1;
}
Expand All @@ -118,7 +119,7 @@ fn vec_append() {
fn vec_push_all() {
let mut r = rand::task_rng();

let mut v = ~[];
let mut v = Vec::new();
for i in range(0u, 1500) {
let mut rv = slice::from_elem(r.gen_range(0u, i + 1), i);
if r.gen() {
Expand All @@ -132,7 +133,7 @@ fn vec_push_all() {
}

fn is_utf8_ascii() {
let mut v : ~[u8] = ~[];
let mut v : Vec<u8> = Vec::new();
for _ in range(0u, 20000) {
v.push('b' as u8);
if !str::is_utf8(v) {
Expand All @@ -143,7 +144,7 @@ fn is_utf8_ascii() {

fn is_utf8_multibyte() {
let s = "b¢€𤭢";
let mut v : ~[u8]= ~[];
let mut v : Vec<u8> = Vec::new();
for _ in range(0u, 5000) {
v.push_all(s.as_bytes());
if !str::is_utf8(v) {
Expand Down
4 changes: 2 additions & 2 deletions src/test/bench/core-uint-to-str.rs
Expand Up @@ -14,9 +14,9 @@ use std::uint;
fn main() {
let args = os::args();
let args = if os::getenv("RUST_BENCH").is_some() {
~[~"", ~"10000000"]
vec!(~"", ~"10000000")
} else if args.len() <= 1u {
~[~"", ~"100000"]
vec!(~"", ~"100000")
} else {
args
};
Expand Down
6 changes: 3 additions & 3 deletions src/test/bench/msgsend-pipes-shared.rs
Expand Up @@ -59,7 +59,7 @@ fn run(args: &[~str]) {
let workers = from_str::<uint>(args[2]).unwrap();
let num_bytes = 100;
let start = time::precise_time_s();
let mut worker_results = ~[];
let mut worker_results = Vec::new();
for _ in range(0u, workers) {
let to_child = to_child.clone();
let mut builder = task::task();
Expand Down Expand Up @@ -96,9 +96,9 @@ fn run(args: &[~str]) {
fn main() {
let args = os::args();
let args = if os::getenv("RUST_BENCH").is_some() {
~[~"", ~"1000000", ~"10000"]
vec!(~"", ~"1000000", ~"10000")
} else if args.len() <= 1u {
~[~"", ~"10000", ~"4"]
vec!(~"", ~"10000", ~"4")
} else {
args.clone()
};
Expand Down
6 changes: 3 additions & 3 deletions src/test/bench/msgsend-pipes.rs
Expand Up @@ -53,7 +53,7 @@ fn run(args: &[~str]) {
let workers = from_str::<uint>(args[2]).unwrap();
let num_bytes = 100;
let start = time::precise_time_s();
let mut worker_results = ~[];
let mut worker_results = Vec::new();
let from_parent = if workers == 1 {
let (to_child, from_parent) = channel();
let mut builder = task::task();
Expand Down Expand Up @@ -106,9 +106,9 @@ fn run(args: &[~str]) {
fn main() {
let args = os::args();
let args = if os::getenv("RUST_BENCH").is_some() {
~[~"", ~"1000000", ~"8"]
vec!(~"", ~"1000000", ~"8")
} else if args.len() <= 1u {
~[~"", ~"10000", ~"4"]
vec!(~"", ~"10000", ~"4")
} else {
args.clone()
};
Expand Down
10 changes: 5 additions & 5 deletions src/test/bench/msgsend-ring-mutex-arcs.rs
Expand Up @@ -25,7 +25,7 @@ use std::os;
use std::uint;

// A poor man's pipe.
type pipe = MutexArc<~[uint]>;
type pipe = MutexArc<Vec<uint> >;

fn send(p: &pipe, msg: uint) {
unsafe {
Expand All @@ -47,7 +47,7 @@ fn recv(p: &pipe) -> uint {
}

fn init() -> (pipe,pipe) {
let m = MutexArc::new(~[]);
let m = MutexArc::new(Vec::new());
((&m).clone(), m)
}

Expand All @@ -71,9 +71,9 @@ fn thread_ring(i: uint, count: uint, num_chan: pipe, num_port: pipe) {
fn main() {
let args = os::args();
let args = if os::getenv("RUST_BENCH").is_some() {
~[~"", ~"100", ~"10000"]
vec!(~"", ~"100", ~"10000")
} else if args.len() <= 1u {
~[~"", ~"10", ~"100"]
vec!(~"", ~"10", ~"100")
} else {
args.clone()
};
Expand All @@ -86,7 +86,7 @@ fn main() {
let start = time::precise_time_s();

// create the ring
let mut futures = ~[];
let mut futures = Vec::new();

for i in range(1u, num_tasks) {
//println!("spawning %?", i);
Expand Down
10 changes: 5 additions & 5 deletions src/test/bench/msgsend-ring-rw-arcs.rs
Expand Up @@ -24,7 +24,7 @@ use std::os;
use std::uint;

// A poor man's pipe.
type pipe = RWArc<~[uint]>;
type pipe = RWArc<Vec<uint> >;

fn send(p: &pipe, msg: uint) {
p.write_cond(|state, cond| {
Expand All @@ -42,7 +42,7 @@ fn recv(p: &pipe) -> uint {
}

fn init() -> (pipe,pipe) {
let x = RWArc::new(~[]);
let x = RWArc::new(Vec::new());
((&x).clone(), x)
}

Expand All @@ -66,9 +66,9 @@ fn thread_ring(i: uint, count: uint, num_chan: pipe, num_port: pipe) {
fn main() {
let args = os::args();
let args = if os::getenv("RUST_BENCH").is_some() {
~[~"", ~"100", ~"10000"]
vec!(~"", ~"100", ~"10000")
} else if args.len() <= 1u {
~[~"", ~"10", ~"100"]
vec!(~"", ~"10", ~"100")
} else {
args.clone()
};
Expand All @@ -81,7 +81,7 @@ fn main() {
let start = time::precise_time_s();

// create the ring
let mut futures = ~[];
let mut futures = Vec::new();

for i in range(1u, num_tasks) {
//println!("spawning %?", i);
Expand Down
4 changes: 2 additions & 2 deletions src/test/bench/shootout-ackermann.rs
Expand Up @@ -25,9 +25,9 @@ fn ack(m: int, n: int) -> int {
fn main() {
let args = os::args();
let args = if os::getenv("RUST_BENCH").is_some() {
~[~"", ~"12"]
vec!(~"", ~"12")
} else if args.len() <= 1u {
~[~"", ~"8"]
vec!(~"", ~"8")
} else {
args
};
Expand Down
16 changes: 8 additions & 8 deletions src/test/bench/shootout-chameneos-redux.rs
Expand Up @@ -39,7 +39,7 @@ fn show_color(cc: color) -> ~str {
}
}

fn show_color_list(set: ~[color]) -> ~str {
fn show_color_list(set: vec!(color)) -> ~str {
let mut out = ~"";
for col in set.iter() {
out.push_char(' ');
Expand Down Expand Up @@ -132,7 +132,7 @@ fn creature(
}
}
fn rendezvous(nn: uint, set: ~[color]) {
fn rendezvous(nn: uint, set: vec!(color)) {
// these ports will allow us to hear from the creatures
let (to_rendezvous, from_creatures) = channel::<CreatureInfo>();
Expand All @@ -141,7 +141,7 @@ fn rendezvous(nn: uint, set: ~[color]) {
// these channels will be passed to the creatures so they can talk to us
// these channels will allow us to talk to each creature by 'name'/index
let to_creature: ~[Sender<Option<CreatureInfo>>] =
let to_creature: Vec<Sender<Option<CreatureInfo>>> =
set.iter().enumerate().map(|(ii, col)| {
// create each creature as a listener with a port, and
// give us a channel to talk to each
Expand Down Expand Up @@ -179,7 +179,7 @@ fn rendezvous(nn: uint, set: ~[color]) {
}
// save each creature's meeting stats
let mut report = ~[];
let mut report = Vec::new();
for _to_one in to_creature.iter() {
report.push(from_creatures_log.recv());
}
Expand All @@ -199,9 +199,9 @@ fn rendezvous(nn: uint, set: ~[color]) {
fn main() {
let args = os::args();
let args = if os::getenv("RUST_BENCH").is_some() {
~[~"", ~"200000"]
vec!(~"", ~"200000")
} else if args.len() <= 1u {
~[~"", ~"600"]
vec!(~"", ~"600")
} else {
args
};
Expand All @@ -211,9 +211,9 @@ fn main() {
print_complements();
println!("");

rendezvous(nn, ~[Blue, Red, Yellow]);
rendezvous(nn, vec!(Blue, Red, Yellow));
println!("");

rendezvous(nn,
~[Blue, Red, Yellow, Red, Yellow, Blue, Red, Yellow, Red, Blue]);
vec!(Blue, Red, Yellow, Red, Yellow, Blue, Red, Yellow, Red, Blue));
}
4 changes: 2 additions & 2 deletions src/test/bench/shootout-fasta-redux.rs
Expand Up @@ -59,8 +59,8 @@ static HOMO_SAPIENS: [AminoAcid, ..4] = [
];

// FIXME: Use map().
fn sum_and_scale(a: &'static [AminoAcid]) -> ~[AminoAcid] {
let mut result = ~[];
fn sum_and_scale(a: &'static [AminoAcid]) -> Vec<AminoAcid> {
let mut result = Vec::new();
let mut p = 0f32;
for a_i in a.iter() {
let mut a_i = *a_i;
Expand Down
3 changes: 1 addition & 2 deletions src/test/bench/shootout-fasta.rs
Expand Up @@ -36,8 +36,7 @@ impl MyRandom {

struct AAGen<'a> {
rng: &'a mut MyRandom,
data: ~[(u32, u8)]
}
data: Vec<(u32, u8)> }
impl<'a> AAGen<'a> {
fn new<'b>(rng: &'b mut MyRandom, aa: &[(char, f32)]) -> AAGen<'b> {
let mut cum = 0.;
Expand Down
4 changes: 2 additions & 2 deletions src/test/bench/shootout-fibo.rs
Expand Up @@ -21,9 +21,9 @@ fn fib(n: int) -> int {
fn main() {
let args = os::args();
let args = if os::getenv("RUST_BENCH").is_some() {
~[~"", ~"40"]
vec!(~"", ~"40")
} else if args.len() <= 1u {
~[~"", ~"30"]
vec!(~"", ~"30")
} else {
args
};
Expand Down

0 comments on commit 579eb24

Please sign in to comment.