MCPcopy Create free account
hub / github.com/bitflags/bitflags / cases

Function cases

src/tests/remove.rs:6–38  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4
5#[test]
6fn cases() {
7 case(
8 TestFlags::empty(),
9 &[
10 (TestFlags::A, 0),
11 (TestFlags::empty(), 0),
12 (TestFlags::from_bits_retain(1 << 3), 0),
13 ],
14 TestFlags::remove,
15 TestFlags::set,
16 );
17
18 case(
19 TestFlags::A,
20 &[
21 (TestFlags::A, 0),
22 (TestFlags::empty(), 1),
23 (TestFlags::B, 1),
24 ],
25 TestFlags::remove,
26 TestFlags::set,
27 );
28
29 case(
30 TestFlags::ABC,
31 &[
32 (TestFlags::A, 1 << 1 | 1 << 2),
33 (TestFlags::A | TestFlags::C, 1 << 1),
34 ],
35 TestFlags::remove,
36 TestFlags::set,
37 );
38}
39
40#[track_caller]
41fn case<T: Flags + std::fmt::Debug + Copy>(

Callers

nothing calls this directly

Calls 1

caseFunction · 0.70

Tested by

no test coverage detected