add bytes_le roundtrip test

This commit is contained in:
Daniel Faust 2022-05-11 16:57:51 +02:00
parent 9810dc89b2
commit b0ca5a0157

View File

@ -1405,6 +1405,23 @@ mod tests {
assert_eq!(&b_in, b_out); assert_eq!(&b_in, b_out);
} }
#[test]
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)]
fn test_bytes_le_roundtrip() {
let b = [
0xa1, 0xa2, 0xa3, 0xa4, 0xb1, 0xb2, 0xc1, 0xc2, 0xd1, 0xd2, 0xd3,
0xd4, 0xd5, 0xd6, 0xd7, 0xd8,
];
let u1 = Uuid::from_bytes(b);
let b_le = u1.to_bytes_le();
let u2 = Uuid::from_bytes_le(b_le);
assert_eq!(u1, u2);
}
#[test] #[test]
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)]
fn test_iterbytes_impl_for_uuid() { fn test_iterbytes_impl_for_uuid() {