Skip to content

Commit 76cf915

Browse files
jyasskingraydon
authored andcommitted
---
yaml --- r: 277 b: refs/heads/master c: c866672 h: refs/heads/master i: 275: 38da75d v: v3
1 parent eb08042 commit 76cf915

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 3e63343fbc74b54f7776a9d8917b61db2506c2d8
2+
refs/heads/master: c866672a994267c165bef960d90b0fa8f9677b22

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

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
use std;
2+
3+
fn test_init_elt() {
4+
let vec[uint] v = std._vec.init_elt[uint](uint(5), uint(3));
5+
check (std._vec.len[uint](v) == uint(3));
6+
check (v.(0) == uint(5));
7+
check (v.(1) == uint(5));
8+
check (v.(2) == uint(5));
9+
}
10+
11+
fn id(uint x) -> uint {
12+
ret x;
13+
}
14+
fn test_init_fn() {
15+
let fn(uint)->uint op = id;
16+
let vec[uint] v = std._vec.init_fn[uint](op, uint(5));
17+
// FIXME #108: Can't call templated function twice in the same
18+
// program, at the moment.
19+
//check (std._vec.len[uint](v) == uint(5));
20+
check (v.(0) == uint(0));
21+
check (v.(1) == uint(1));
22+
check (v.(2) == uint(2));
23+
check (v.(3) == uint(3));
24+
check (v.(4) == uint(4));
25+
}
26+
27+
fn main() {
28+
test_init_elt();
29+
//XFAIL: test_init_fn(); // Segfaults.
30+
}

0 commit comments

Comments
 (0)