rust/src/test/run-pass/iter-any.rs

12 lines
265 B
Rust
Raw Normal View History

fn is_even(x: &uint) -> bool { (*x % 2) == 0 }
fn main() {
assert ![1u, 3u]/_.any(is_even);
assert [1u, 2u]/_.any(is_even);
assert ![]/_.any(is_even);
assert !Some(1).any(is_even);
assert Some(2).any(is_even);
2012-08-20 14:23:37 -05:00
assert !None.any(is_even);
}