From b0ca5a0157c48430b959acab7b33a74a2dca0884 Mon Sep 17 00:00:00 2001 From: Daniel Faust Date: Wed, 11 May 2022 16:57:51 +0200 Subject: [PATCH] add bytes_le roundtrip test --- src/lib.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 15381c44..1bb5593f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1405,6 +1405,23 @@ mod tests { 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] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] fn test_iterbytes_impl_for_uuid() {