Macro assertables::assert_bag_eq [−][src]
macro_rules! assert_bag_eq { ($left:expr, $right:expr $(,)?) => { ... }; ($left:expr, $right:expr, $($arg:tt)+) => { ... }; }
Expand description
Assert two bags are equal.
-
When true, return
(). -
Otherwise, call
panic!in order to print the values of the expressions with their debug representations.
Examples
assert_bag_eq!([1, 1], [1, 1]); //-> ()
// assert_bag_eq!([1, 1], [1, 1, 1]); //-> panic!("assertion failed: `assert_bag_eq(left, right)`\n left: `[1, 1]`\n right: `[1, 1, 1]`")
This macro has a second form where a custom message can be provided.
This implementation uses [HashMap] to count items.