aienux
Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.
Brought by drakestapleton
aienux / vendor / bitflags / src / tests / all.rs
| 1 | use super::*; |
| 2 | |
| 3 | use crate::Flags; |
| 4 | |
| 5 | #[test] |
| 6 | fn cases() { |
| 7 | case(1 | 1 << 1 | 1 << 2, TestFlags::all); |
| 8 | |
| 9 | case(0, TestZero::all); |
| 10 | |
| 11 | case(0, TestEmpty::all); |
| 12 | |
| 13 | case(!0, TestExternal::all); |
| 14 | } |
| 15 | |
| 16 | #[track_caller] |
| 17 | fn case<T: Flags>(expected: T::Bits, inherent: impl FnOnce() -> T) |
| 18 | where |
| 19 | <T as Flags>::Bits: std::fmt::Debug + PartialEq, |
| 20 | { |
| 21 | assert_eq!(expected, inherent().bits(), "T::all()"); |
| 22 | assert_eq!(expected, T::all().bits(), "Flags::all()"); |
| 23 | } |