1 use super::*;
2 
3 use crate::Flags;
4 
5 #[test]
cases()6 fn cases() {
7     case(true, TestFlags::empty(), TestFlags::is_empty);
8 
9     case(false, TestFlags::A, TestFlags::is_empty);
10     case(false, TestFlags::ABC, TestFlags::is_empty);
11     case(
12         false,
13         TestFlags::from_bits_retain(1 << 3),
14         TestFlags::is_empty,
15     );
16 
17     case(true, TestZero::empty(), TestZero::is_empty);
18 
19     case(true, TestEmpty::empty(), TestEmpty::is_empty);
20 }
21 
22 #[track_caller]
case<T: Flags + std::fmt::Debug>(expected: bool, value: T, inherent: impl FnOnce(&T) -> bool)23 fn case<T: Flags + std::fmt::Debug>(expected: bool, value: T, inherent: impl FnOnce(&T) -> bool) {
24     assert_eq!(expected, inherent(&value), "{:?}.is_empty()", value);
25     assert_eq!(
26         expected,
27         Flags::is_empty(&value),
28         "Flags::is_empty({:?})",
29         value
30     );
31 }
32