Macro assertables::assert_bag_superbag

source ·
macro_rules! assert_bag_superbag {
    ($a_collection:expr, $b_collection:expr $(,)?) => { ... };
    ($a_collection:expr, $b_collection:expr, $($message:tt)+) => { ... };
}
Expand description

Assert a bag is a superbag of another.

  • If true, return ().

  • Otherwise, call panic! in order to print the values of the expressions with their debug representations.

§Examples

let a = [1, 1, 1];
let b = [1, 1];
assert_bag_superbag!(&a, &b);

let a = [1, 1];
let b = [1, 1, 1];
assert_bag_superbag!(&a, &b);
// assertion failed: `assert_bag_superbag!(a_collection, b_collection)`
//  a label: `&a`,
//  a debug: `[1, 1]`,
//  b label: `&b`,
//  b debug: `[1, 1, 1]`,
//        a: `{1: 2}`,
//        b: `{1: 3}`

This implementation uses std::collections::BTreeMap to count items and sort them.

§Module macros