ps_ecc/long/header/overlap_factor/implementations/from/
u8.rs1use crate::long::header::OverlapFactor;
2
3impl From<u8> for OverlapFactor {
4 #[inline]
5 fn from(byte: u8) -> Self {
6 Self::from_u8(byte)
7 }
8}
9
10#[cfg(test)]
11mod tests {
12 use crate::long::OverlapFactor;
13
14 #[test]
15 fn test_from_u8_impl_matches_from_u8() {
16 for byte in [0x00, 0x40, 0x80, 0xC0, 0x3F, 0x7F, 0xBF, 0xFF] {
17 assert_eq!(OverlapFactor::from(byte), OverlapFactor::from_u8(byte));
18 }
19 }
20
21 #[test]
22 fn test_into_overlap_factor() {
23 let factor: OverlapFactor = 0x80u8.into();
24
25 assert_eq!(factor, OverlapFactor::Triple);
26 }
27}