PageRenderTime 20ms CodeModel.GetById 16ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/src/test/run-pass/ivec-add.rs

http://github.com/jruderman/rust
Rust | 14 lines | 10 code | 4 blank | 0 comment | 4 complexity | bbf47d6bb02296ca6c9fc9ba8cc2bd96 MD5 | raw file
 1fn double<T: copy>(a: T) -> ~[T] { return ~[a] + ~[a]; }
 2
 3fn double_int(a: int) -> ~[int] { return ~[a] + ~[a]; }
 4
 5fn main() {
 6    let mut d = double(1);
 7    assert (d[0] == 1);
 8    assert (d[1] == 1);
 9
10    d = double_int(1);
11    assert (d[0] == 1);
12    assert (d[1] == 1);
13}
14