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