Macro assertables::assert_ge
source · [−]macro_rules! assert_ge {
($a:expr, $b:expr $(,)?) => { ... };
($a:expr, $b:expr, $($arg:tt)+) => { ... };
}Expand description
Assert a value is greater 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
assert_ge!(2, 1);
//-> ()
let result = panic::catch_unwind(|| {
assert_ge!(1, 2);
//-> panic!
});
let actual = result.unwrap_err().downcast::<String>().unwrap().to_string();
let expect = concat!(
"assertion failed: `assert_ge!(left, right)`\n",
" left: `1`,\n",
" right: `2`"
);
assert_eq!(actual, expect);