macro_rules! assert_count_le_x {
($a:expr, $b:expr $(,)?) => { ... };
($a:expr, $b:expr, $($message:tt)+) => { ... };
}Expand description
Assert a count is less than or equal to an expression.
Pseudocode:
a.count() ≤ b
-
If true, return
(a.count(), b). -
Otherwise, call
panic!with a message and the values of the expressions with their debug representations.
§Examples
use assertables::*;
let a = "x".chars();
let b = 2;
assert_count_le_x!(a, b);
// This will panic
let a = "xx".chars();
let b = 1;
assert_count_le_x!(a, b);
// assertion failed: `assert_count_le_x!(a, b)`
// https://docs.rs/assertables/…/assertables/macro.assert_count_le_x.html
// a label: `a`,
// a debug: `Chars(['x', 'x'])`,
// a.count(): `2`",
// b label: `b`,
// b debug: `1`