mirror of
https://git.proxmox.com/git/rustc
synced 2025-08-15 02:31:20 +00:00
22 lines
453 B
Rust
22 lines
453 B
Rust
extern crate quickcheck;
|
|
|
|
use quickcheck::{TestResult, quickcheck};
|
|
|
|
fn reverse<T: Clone>(xs: &[T]) -> Vec<T> {
|
|
let mut rev = vec!();
|
|
for x in xs {
|
|
rev.insert(0, x.clone())
|
|
}
|
|
rev
|
|
}
|
|
|
|
fn main() {
|
|
fn prop(xs: Vec<isize>) -> TestResult {
|
|
if xs.len() != 1 {
|
|
return TestResult::discard()
|
|
}
|
|
TestResult::from_bool(xs == reverse(&*xs))
|
|
}
|
|
quickcheck(prop as fn(Vec<isize>) -> TestResult);
|
|
}
|