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/known_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 / known_bits.rs` 47 lines ยท 1032 bytes Raw Blame History 1 use super::*; 2 3 use crate::Flags; 4 5 #[test] 6 fn cases() { 7 case(0, TestFlags::empty(), TestFlags::known_bits); 8 case(1, TestFlags::A, TestFlags::known_bits); 9 case(1 | 1 << 1 | 1 << 2, TestFlags::all(), TestFlags::known_bits); 10 11 case( 12 1 | 1 << 1 | 1 << 2, 13 TestFlags::ABC | TestFlags::from_bits_retain(1 << 3), 14 TestFlags::known_bits, 15 ); 16 17 case( 18 0, 19 TestFlags::from_bits_retain(1 << 3), 20 TestFlags::known_bits, 21 ); 22 23 case(0, TestZero::empty(), TestZero::known_bits); 24 25 case( 26 0xFF, 27 TestExternal::from_bits_retain(0xFF), 28 TestExternal::known_bits, 29 ); 30 } 31 32 #[track_caller] 33 fn case( 34 expected: T::Bits, 35 value: T, 36 inherent: impl FnOnce(&T) -> T::Bits, 37 ) where 38 T::Bits: std::fmt::Debug + PartialEq, 39 { 40 assert_eq!(expected, inherent(&value), "{:?}.known_bits()", value); 41 assert_eq!( 42 expected, 43 Flags::known_bits(&value), 44 "Flags::known_bits({:?})", 45 value, 46 ); 47 }