Function swift_check::xor

source ·
pub const fn xor(
    a: impl Fn(Vector) -> Vector,
    b: impl Fn(Vector) -> Vector
) -> impl Fn(Vector) -> Vector
Expand description

Check that only one of the conditions are met

§Arguments

  • a - The lhs condition
  • b - The rhs condition

§Example

use swift_check::{ensure, xor, range, arch::load};

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

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

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

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