rust/src/test/run-pass/vec-self-append.rs

16 lines
329 B
Rust
Raw Normal View History

use std;
2011-08-12 01:43:17 -05:00
import std::ivec;
2011-07-27 07:19:39 -05:00
fn main() {
// Make sure we properly handle repeated self-appends.
2011-08-12 01:43:17 -05:00
let a: [int] = ~[0];
2011-07-27 07:19:39 -05:00
let i = 20;
let expected_len = 1u;
while i > 0 {
2011-08-12 01:43:17 -05:00
log_err ivec::len(a);
assert (ivec::len(a) == expected_len);
a += a;
i -= 1;
expected_len *= 2u;
}
2011-07-27 07:19:39 -05:00
}