Macro assertables::assert_f_ok_le
source · [−]macro_rules! assert_f_ok_le {
($function:path, $left:expr, $right:expr $(,)?) => { ... };
($function:path, $left:expr, $right:expr, $($arg:tt)+) => { ... };
}Expand description
Assert a function ok() is less than or equal to another.
-
When true, return
(). -
Otherwise, call
panic!with a message and the values of the expressions with their debug representations.
Examples
use std::str::FromStr;
assert_f_ok_le!(i32::from_str, "1", "2");
//-> ()
use std::str::FromStr;
assert_f_ok_le!(i32::from_str, "2", "1");
//-> panic!("…")
// assertion failed: `assert_f_ok_le!(function, left, right)`
// left input: `\"2\"`,
// right input: `\"1\"`,
// left output: `2`,
// right output: `1`This macro has a second form where a custom message can be provided.