PageRenderTime 4ms CodeModel.GetById 1ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/src/test/run-pass/vec.rs

http://github.com/jruderman/rust
Rust | 15 lines | 11 code | 3 blank | 1 comment | 6 complexity | bf38d5655c0f7e2cb92b6322ec7ecedc MD5 | raw file
 1
 2
 3
 4// -*- rust -*-
 5fn main() {
 6    let v: ~[int] = ~[10, 20];
 7    assert (v[0] == 10);
 8    assert (v[1] == 20);
 9    let mut x: int = 0;
10    assert (v[x] == 10);
11    assert (v[x + 1] == 20);
12    x = x + 1;
13    assert (v[x] == 20);
14    assert (v[x - 1] == 10);
15}