Function
case
(
value: T,
inputs: &[(T, bool)],
mut inherent: impl FnMut(&T, T) -> bool,
)
Source from the content-addressed store, hash-verified
| 85 | |
| 86 | #[track_caller] |
| 87 | fn case<T: Flags + std::fmt::Debug + Copy>( |
| 88 | value: T, |
| 89 | inputs: &[(T, bool)], |
| 90 | mut inherent: impl FnMut(&T, T) -> bool, |
| 91 | ) { |
| 92 | for (input, expected) in inputs { |
| 93 | assert_eq!( |
| 94 | *expected, |
| 95 | inherent(&value, *input), |
| 96 | "{:?}.contains({:?})", |
| 97 | value, |
| 98 | input |
| 99 | ); |
| 100 | assert_eq!( |
| 101 | *expected, |
| 102 | Flags::contains(&value, *input), |
| 103 | "Flags::contains({:?}, {:?})", |
| 104 | value, |
| 105 | input |
| 106 | ); |
| 107 | } |
| 108 | } |
Tested by
no test coverage detected