From 216366f433b8eb647a4ad74cb8e30dc673ea524a Mon Sep 17 00:00:00 2001 From: Paolo Barbolini Date: Mon, 19 Aug 2024 15:08:14 +0200 Subject: [PATCH] test: add regression test for #730 --- tests/test_buf.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/test_buf.rs b/tests/test_buf.rs index 3940f9247..8b47014bb 100644 --- a/tests/test_buf.rs +++ b/tests/test_buf.rs @@ -36,6 +36,14 @@ fn test_get_u16() { assert_eq!(0x5421, buf.get_u16_le()); } +#[test] +fn test_get_int() { + let mut buf = &b"\xfe\x1d\xc0zomg"[..]; + assert_eq!(0xffffffffffc01dfeu64 as i64, buf.get_int_le(3)); + let mut buf = &b"\xfe\x1d\xc0zomg"[..]; + assert_eq!(0xfffffffffffe1dc0u64 as i64, buf.get_int(3)); +} + #[test] #[should_panic] fn test_get_u16_buffer_underflow() {