From a05cd8134aa8860e81ce046cd112a4d2580cb264 Mon Sep 17 00:00:00 2001 From: Kiran Shila Date: Fri, 5 Apr 2024 15:21:16 -0700 Subject: [PATCH] Add endianness check test --- src/read.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/read.rs b/src/read.rs index 1de442e..7184f1b 100644 --- a/src/read.rs +++ b/src/read.rs @@ -523,6 +523,18 @@ mod tests { assert_eq!(b"HEADER_END", e); } + #[test] + fn test_wrong_endian() { + let hstart = sigproc_string("HEADER_START"); + let a = header_start(&hstart, Endianness::Big); + let b = header_start(&hstart, Endianness::Little); + if a.is_err() { + assert!(b.is_ok()) + } else { + assert!(b.is_err()) + } + } + #[test] fn test_numeric_headers() { let mut az = sigproc_string("az_start");