Created
March 31, 2016 22:38
-
-
Save blt/71dbfa9748fa185dec1e506ba9000da0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![cfg_attr(test, feature(plugin))] | |
#![cfg_attr(test, plugin(quickcheck_macros))] | |
#[cfg(test)] | |
extern crate quickcheck; | |
fn reverse<T: Clone>(xs: &[T]) -> Vec<T> { | |
let mut rev = vec!(); | |
for x in xs { | |
rev.insert(0, x.clone()) | |
} | |
rev | |
} | |
#[cfg(test)] | |
mod tests { | |
#[quickcheck] | |
fn double_reversal_is_identity(xs: Vec<isize>) -> bool { | |
xs == super::reverse(&super::reverse(&xs)) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment