More number conversion code

100% coverage
This commit is contained in:
2025-06-02 10:25:59 -04:00
parent 60232b958f
commit 12d738389b
5 changed files with 84 additions and 30 deletions
+16
View File
@@ -81,3 +81,19 @@ fn split_bytes_u16_join_bytes_u16() {
NumberSystemConversion::join_bytes_u16(high as u16, low as u16));
}
}
#[test]
fn combine_u8_to_u16() {
let test_params: Vec<((u8, u8), u16)> = vec![
((0xff, 0x00), 0x00ff),
((0x00, 0xff), 0xff00),
((0xbe, 0xef), 0xefbe),
((0xef, 0xbe), 0xbeef)
];
for ((low, high), base) in test_params {
assert_eq!(
base, NumberSystemConversion::combine_u8_to_u16(low, high)
)
}
}