MCPcopy Create free account
hub / github.com/Lymia/enumset / test_insert_all_remove_all

Function test_insert_all_remove_all

enumset_test/tests/mixedset_basic_ops.rs:217–241  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

215
216#[test]
217fn test_insert_all_remove_all() {
218 let mut set = MixedEnumSet::from(Enum::A);
219 set.insert_bit(1);
220 set.insert_all(Enum::B | Enum::C);
221 assert_eq!(set.len(), 4);
222 assert!(set.contains(Enum::A));
223 assert!(set.contains(Enum::B));
224 assert!(set.contains(Enum::C));
225 assert!(set.has_bit(1));
226
227 set.remove_all(Enum::A | Enum::B);
228 assert_eq!(set.len(), 2);
229 assert!(!set.contains(Enum::A));
230 assert!(!set.contains(Enum::B));
231 assert!(set.contains(Enum::C));
232 assert!(set.has_bit(1));
233
234 // remove_all also accepts MixedEnumSet (containing unknown bits)
235 let mut other = MixedEnumSet::<Enum>::new();
236 other.insert_bit(1);
237 set.remove_all(other);
238 assert_eq!(set.len(), 1);
239 assert!(!set.has_bit(1));
240 assert!(set.contains(Enum::C));
241}
242
243#[test]
244fn test_set_algebra() {

Callers

nothing calls this directly

Calls 4

newFunction · 0.85
insert_bitMethod · 0.80
insert_allMethod · 0.45
remove_allMethod · 0.45

Tested by

no test coverage detected