macro_rules! quickcheck {
    (@as_items $($i:item)*) => { ... };
    {
        $(
            $(#[$m:meta])*
            fn $fn_name:ident($($arg_name:ident : $arg_ty:ty),*) -> $ret:ty {
                $($code:tt)*
            }
        )*
    } => { ... };
}
Expand description

A macro for writing quickcheck tests.

This macro takes as input one or more property functions to test, and produces a proper #[test] function for each property. If the property fails, the behavior is as if quickcheck were called on the property (i.e., it panics and fails the test).

Note that this macro doesn’t support mut or patterns in parameters.

Example

quickcheck! {
    fn prop_reverse_reverse(xs: Vec<usize>) -> bool {
        let rev: Vec<_> = xs.clone().into_iter().rev().collect();
        let revrev: Vec<_> = rev.into_iter().rev().collect();
        xs == revrev
    }
};