test: Fix tests.
This commit is contained in:
parent
e20549ff19
commit
2dbb3c3887
36 changed files with 217 additions and 243 deletions
|
|
@ -75,7 +75,7 @@ fn read_line() {
|
|||
.push_rel(&Path("src/test/bench/shootout-k-nucleotide.data"));
|
||||
|
||||
for int::range(0, 3) |_i| {
|
||||
let reader = result::get(&io::file_reader(&path));
|
||||
let reader = result::unwrap(io::file_reader(&path));
|
||||
while !reader.eof() {
|
||||
reader.read_line();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -154,6 +154,15 @@ fn bfs(graph: graph, key: node_id) -> bfs_result {
|
|||
marks
|
||||
}
|
||||
|
||||
#[deriving(Clone)]
|
||||
enum color {
|
||||
white,
|
||||
// node_id marks which node turned this gray/black.
|
||||
// the node id later becomes the parent.
|
||||
gray(node_id),
|
||||
black(node_id)
|
||||
}
|
||||
|
||||
/**
|
||||
* Another version of the bfs function.
|
||||
*
|
||||
|
|
@ -163,14 +172,6 @@ fn bfs(graph: graph, key: node_id) -> bfs_result {
|
|||
fn bfs2(graph: graph, key: node_id) -> bfs_result {
|
||||
// This works by doing functional updates of a color vector.
|
||||
|
||||
enum color {
|
||||
white,
|
||||
// node_id marks which node turned this gray/black.
|
||||
// the node id later becomes the parent.
|
||||
gray(node_id),
|
||||
black(node_id)
|
||||
};
|
||||
|
||||
let mut colors = do vec::from_fn(graph.len()) |i| {
|
||||
if i as node_id == key {
|
||||
gray(key)
|
||||
|
|
@ -236,14 +237,6 @@ fn bfs2(graph: graph, key: node_id) -> bfs_result {
|
|||
fn pbfs(graph: &arc::ARC<graph>, key: node_id) -> bfs_result {
|
||||
// This works by doing functional updates of a color vector.
|
||||
|
||||
enum color {
|
||||
white,
|
||||
// node_id marks which node turned this gray/black.
|
||||
// the node id later becomes the parent.
|
||||
gray(node_id),
|
||||
black(node_id)
|
||||
};
|
||||
|
||||
let graph_vec = graph.get(); // FIXME #3387 requires this temp
|
||||
let mut colors = do vec::from_fn(graph_vec.len()) |i| {
|
||||
if i as node_id == key {
|
||||
|
|
|
|||
|
|
@ -124,8 +124,8 @@ fn main() {
|
|||
};
|
||||
|
||||
let writer = if os::getenv("RUST_BENCH").is_some() {
|
||||
result::get(&io::file_writer(&Path("./shootout-fasta.data"),
|
||||
[io::Truncate, io::Create]))
|
||||
result::unwrap(io::file_writer(&Path("./shootout-fasta.data"),
|
||||
[io::Truncate, io::Create]))
|
||||
} else {
|
||||
io::stdout()
|
||||
};
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ fn main() {
|
|||
// get to this massive data set, but include_bin! chokes on it (#2598)
|
||||
let path = Path(env!("CFG_SRC_DIR"))
|
||||
.push_rel(&Path("src/test/bench/shootout-k-nucleotide.data"));
|
||||
result::get(&io::file_reader(&path))
|
||||
result::unwrap(io::file_reader(&path))
|
||||
} else {
|
||||
io::stdin()
|
||||
};
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ fn give_any(f: &fn:()) {
|
|||
|
||||
fn give_owned(f: &fn:Send()) {
|
||||
take_any(f);
|
||||
take_const_owned(f); //~ ERROR expected bounds `Freeze+Send` but found bounds `Send`
|
||||
take_const_owned(f); //~ ERROR expected bounds `Send+Freeze` but found bounds `Send`
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ fn main() {
|
|||
let mut res = foo(x);
|
||||
|
||||
let mut v = ~[];
|
||||
v = ~[(res)] + v; //~ instantiating a type parameter with an incompatible type `foo`, which does not fulfill `Clone`
|
||||
v = ~[(res)] + v; //~ failed to find an implementation of trait
|
||||
assert_eq!(v.len(), 2);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,11 +14,8 @@ trait Foo {
|
|||
fn a(_x: ~Foo:Send) {
|
||||
}
|
||||
|
||||
fn b(_x: ~Foo:Send+Clone) {
|
||||
}
|
||||
|
||||
fn c(x: ~Foo:Freeze+Send) {
|
||||
b(x); //~ ERROR expected bounds `Clone+Send`
|
||||
a(x);
|
||||
}
|
||||
|
||||
fn d(x: ~Foo:) {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// error-pattern: instantiating a type parameter with an incompatible type
|
||||
// error-pattern: failed to find an implementation
|
||||
|
||||
struct r {
|
||||
i:int
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ trait methods {
|
|||
|
||||
impl methods for () {
|
||||
fn to_bytes(&self) -> ~[u8] {
|
||||
vec::from_elem(0, 0)
|
||||
vec::from_elem(0, 0u8)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
extern mod extra;
|
||||
use extra::list;
|
||||
|
||||
#[deriving(Clone)]
|
||||
enum foo {
|
||||
a(uint),
|
||||
b(~str),
|
||||
|
|
|
|||
|
|
@ -14,15 +14,15 @@ extern mod extra;
|
|||
|
||||
use extra::list::*;
|
||||
|
||||
fn pure_length_go<T>(ls: @List<T>, acc: uint) -> uint {
|
||||
fn pure_length_go<T:Clone>(ls: @List<T>, acc: uint) -> uint {
|
||||
match *ls { Nil => { acc } Cons(_, tl) => { pure_length_go(tl, acc + 1u) } }
|
||||
}
|
||||
|
||||
fn pure_length<T>(ls: @List<T>) -> uint { pure_length_go(ls, 0u) }
|
||||
fn pure_length<T:Clone>(ls: @List<T>) -> uint { pure_length_go(ls, 0u) }
|
||||
|
||||
fn nonempty_list<T>(ls: @List<T>) -> bool { pure_length(ls) > 0u }
|
||||
fn nonempty_list<T:Clone>(ls: @List<T>) -> bool { pure_length(ls) > 0u }
|
||||
|
||||
fn safe_head<T>(ls: @List<T>) -> T {
|
||||
fn safe_head<T:Clone>(ls: @List<T>) -> T {
|
||||
assert!(!is_empty(ls));
|
||||
return head(ls);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,16 +8,15 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
pub fn main() {
|
||||
struct Foo { a: ~str }
|
||||
#[deriving(Clone)]
|
||||
struct Foo {
|
||||
a: ~str,
|
||||
}
|
||||
|
||||
let v = [ ~Foo { a: ~"Hello!" }, ..129 ];
|
||||
let w = [ ~"Hello!", ..129 ];
|
||||
pub fn main() {
|
||||
let x = [ @[true], ..512 ];
|
||||
let y = [ 0, ..1 ];
|
||||
|
||||
error!("%?", v);
|
||||
error!("%?", w);
|
||||
error!("%?", x);
|
||||
error!("%?", y);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue