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