macro_rules! assert_any_gt_x {
($iter:expr, $x:expr $(,)?) => { ... };
($iter:expr, $x:expr, $($message:tt)+) => { ... };
}Expand description
Assert any element of an iterable is greater than a value.
Pseudocode:
iter ∃ > x
-
If true, return
(). -
Otherwise, call
panic!with a message and the values of the expressions with their debug representations.
§Examples
use assertables::*;
let a = [3, 4];
let b = 3;
assert_any_gt_x!(a.iter(), b);
// This will panic
let a = [1, 2];
let b = 2;
assert_any_gt_x!(a.iter(), b);
// assertion failed: `assert_any_gt_x!(iter, x)`
// https://docs.rs/assertables/…/assertables/macro.assert_any_gt_x.html
// iter label: `a.iter()`,
// iter debug: `Iter([])`,
// x label: `b`,\n",
// x debug: `0`",This implementation uses ::std::iter::Iterator.