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 / truncate.rs
| 1 | use super::*; |
| 2 | |
| 3 | use crate::Flags; |
| 4 | |
| 5 | #[test] |
| 6 | fn cases() { |
| 7 | case( |
| 8 | TestFlags::ABC | TestFlags::from_bits_retain(1 << 3), |
| 9 | TestFlags::ABC, |
| 10 | ); |
| 11 | |
| 12 | case(TestZero::empty(), TestZero::empty()); |
| 13 | |
| 14 | case(TestZero::all(), TestZero::all()); |
| 15 | |
| 16 | case( |
| 17 | TestFlags::from_bits_retain(1 << 3) | TestFlags::all(), |
| 18 | TestFlags::all(), |
| 19 | ); |
| 20 | } |
| 21 | |
| 22 | #[track_caller] |
| 23 | fn case<T: Flags + std::fmt::Debug>(mut before: T, after: T) |
| 24 | where |
| 25 | T: std::fmt::Debug + PartialEq + Copy, |
| 26 | { |
| 27 | before.truncate(); |
| 28 | assert_eq!(before, after, "{:?}.truncate()", before); |
| 29 | } |