Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aienux/blob/main/vendor/bitflags/src/tests/unknown_bits.rs # aienux Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aienux / vendor / bitflags / src / tests / unknown_bits.rs` 53 lines ยท 1143 bytes Raw Blame History 1 use super::*; 2 3 use crate::Flags; 4 5 #[test] 6 fn cases() { 7 case(0, TestFlags::empty(), TestFlags::unknown_bits); 8 case(0, TestFlags::A, TestFlags::unknown_bits); 9 case(0, TestFlags::all(), TestFlags::unknown_bits); 10 11 case( 12 1 << 3, 13 TestFlags::ABC | TestFlags::from_bits_retain(1 << 3), 14 TestFlags::unknown_bits, 15 ); 16 17 case( 18 1 << 3, 19 TestFlags::from_bits_retain(1 << 3), 20 TestFlags::unknown_bits, 21 ); 22 23 case( 24 `0b11111000`, 25 TestFlags::from_bits_retain(`0b11111000`), 26 TestFlags::unknown_bits, 27 ); 28 29 case(0, TestZero::empty(), TestZero::unknown_bits); 30 31 case( 32 0, 33 TestExternal::from_bits_retain(0xFF), 34 TestExternal::unknown_bits, 35 ); 36 } 37 38 #[track_caller] 39 fn case( 40 expected: T::Bits, 41 value: T, 42 inherent: impl FnOnce(&T) -> T::Bits, 43 ) where 44 T::Bits: std::fmt::Debug + PartialEq, 45 { 46 assert_eq!(expected, inherent(&value), "{:?}.unknown_bits()", value); 47 assert_eq!( 48 expected, 49 Flags::unknown_bits(&value), 50 "Flags::unknown_bits({:?})", 51 value, 52 ); 53 }