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