Macro all

Source
macro_rules! all {
    ($left:expr $(,)? ) => { ... };
    ($left:expr, $right:expr $(,)?) => { ... };
    ($left:expr, $right:expr, $($rest:expr),+ $(,)?) => { ... };
}
Expand description

Check that all the conditions hold

§Arguments

  • conditions - The conditions to ensure all hold

§Example

use swift_check::{ensure, all, range, not, eq, arch::load};

let input = b"3333333377777777";
let data = load(input);

let not_five = ensure!(data, all!(range!(b'0'..=b'9'), not(eq(b'5'))));
assert!(not_five);

let input = b"3333333557777777";
let data = load(input);

let should_fail = ensure!(data, all!(range!(b'0'..=b'9'), not(eq(b'5'))));
assert!(!should_fail);