macro_rules! test_assert_ne {
($func_name:ident, $arg:expr => $ans:expr) => { ... };
}Expand description
Generate a test code that internally uses assert_ne!.
The first argument should be the test case name, and the second argument should be the arguments and the unexpected return value.
Put the arguments to the left of “=>” and the unexpected return value to the right of “=>”. And panic if the left is equal to the right.
§Example
fn add(x: i32, y: i32) -> i32 {
x + y
}If you want to test this add function, you can write it as follows
test_macro::test_assert_ne!(test_case_name, add(1, 2) => 0);