Function
case
(
expected: Option<T::Bits>,
input: T::Bits,
inherent: impl FnOnce(T::Bits) -> Option<T>,
)
Source from the content-addressed store, hash-verified
| 24 | |
| 25 | #[track_caller] |
| 26 | fn case<T: Flags>( |
| 27 | expected: Option<T::Bits>, |
| 28 | input: T::Bits, |
| 29 | inherent: impl FnOnce(T::Bits) -> Option<T>, |
| 30 | ) where |
| 31 | <T as Flags>::Bits: std::fmt::Debug + PartialEq, |
| 32 | { |
| 33 | assert_eq!( |
| 34 | expected, |
| 35 | inherent(input).map(|f| f.bits()), |
| 36 | "T::from_bits({:?})", |
| 37 | input |
| 38 | ); |
| 39 | assert_eq!( |
| 40 | expected, |
| 41 | T::from_bits(input).map(|f| f.bits()), |
| 42 | "Flags::from_bits({:?})", |
| 43 | input |
| 44 | ); |
| 45 | } |
Tested by
no test coverage detected