macro_rules! assert_set_ne {
    ($a:expr, $b:expr $(,)?) => { ... };
    ($a:expr, $b:expr, $($arg:tt)+) => { ... };
}
Expand description

Assert a set 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

let a = [1, 2];
let b = [3, 4];
assert_set_ne!(&a, &b);
//-> ()

let result = panic::catch_unwind(|| {
let a = [1, 2];
let b = [2, 1];
assert_set_ne!(&a, &b);
//-> panic!
});
let actual = result.unwrap_err().downcast::<String>().unwrap().to_string();
let expect = concat!(
    "assertion failed: `assert_set_ne!(left, right)`\n",
    "  left: `{1, 2}`,\n",
    " right: `{1, 2}`"
);
assert_eq!(actual, expect);

This implementation uses [BTreeSet] to count items and sort them.