Added additional printers

+ Data types can be printed in different formats
+ The formats respect endianness
+ Fixed tests
+ clippy+fmt
This commit is contained in:
joeyahines committed 2022-04-09 13:33:55 -06:00
1 parent 6407335362
commit 1cf7f06230
4 files changed
+155 -52

No files matched your search

+3 -3
View File
@@ -110,7 +110,7 @@ impl From<Vec<u8>> for ByteStream {
#[cfg(test)]
mod tests {
use super::ByteStream;
use byteorder::BigEndian;
use byteorder::{BigEndian, LittleEndian};
#[test]
fn test_get_bytes_no_shift() {
@@ -137,7 +137,7 @@ mod tests {
let bytes: Vec<u8> = vec![0xff, 0x55];
let bit_stream = ByteStream::from(bytes.clone());
let new_bytes = bit_stream.get_bytes::<BigEndian>(4, 8).unwrap();
let new_bytes = bit_stream.get_bytes::<LittleEndian>(4, 8).unwrap();
assert_eq!(vec![0x5f], new_bytes);
}
@@ -146,7 +146,7 @@ mod tests {
let bytes: Vec<u8> = vec![0xff, 0x55];
let bit_stream = ByteStream::from(bytes.clone());
let new_bytes = bit_stream.get_bytes::<BigEndian>(7, 2).unwrap();
let new_bytes = bit_stream.get_bytes::<LittleEndian>(7, 2).unwrap();
assert_eq!(vec![0x03], new_bytes);
}