Module assertables::assert_set
source · Expand description
Assert macros for comparing set collections.
These macros help with comparison of set parameters, such as two arrays or two vectors. where the item order does not matter, and the item count does not matter. These macros convert their inputs into HashSet iterators.
For eq & ne:
-
assert_set_eq!(collection1, collection2)≈ set a = set b -
assert_set_ne!(collection1, collection2)≈ set a ≠ set b
For subset & superset:
-
assert_set_subset!(collection1, collection2)≈ set a ⊆ set b -
assert_set_superset!(collection1, collection2)≈ set a ⊇ set b
For joint & disjoint:
-
assert_set_joint!(collection1, collection2)≈ set a ∩ set b ≠ ∅ -
assert_set_disjoint!(collection1, collection2)≈ set a ∩ set b = ∅
§Example
let a = [1, 2];
let b = [2, 1];
assert_set_eq!(&a, &b);Modules§
- Assert a set is disjoint with another.
- Assert a set is equal to another.
- Assert a set is joint with another.
- Assert a set is not equal to another.
- Assert a set is a subset of another.
- Assert a set is a superset of another.