2011-04-05 22:42:33 -05:00
|
|
|
// xfail-boot
|
|
|
|
// -*- rust -*-
|
|
|
|
|
|
|
|
type compare[T] = fn(&T t1, &T t2) -> bool;
|
|
|
|
|
|
|
|
fn test_generic[T](&T expected, &compare[T] eq) {
|
|
|
|
let T actual = { expected };
|
2011-05-02 18:24:09 -05:00
|
|
|
check (eq(expected, actual));
|
2011-04-05 22:42:33 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn test_vec() {
|
|
|
|
fn compare_vec(&vec[int] v1, &vec[int] v2) -> bool {
|
|
|
|
ret v1 == v2;
|
|
|
|
}
|
|
|
|
auto eq = bind compare_vec(_, _);
|
|
|
|
test_generic[vec[int]](vec(1, 2), eq);
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
test_vec();
|
|
|
|
}
|