Skip to content

Commit

Permalink
Add Header tests
Browse files Browse the repository at this point in the history
  • Loading branch information
FssAy committed Mar 1, 2024
1 parent de1d17c commit f475f41
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/header.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
use bqsp::{BoxPack, Data, Header};

#[test]
fn byte_repr() {
let box_pack = BoxPack::new(
Data::from([0x00_u8; 16].as_slice()),
1u16,
1,
);

let header_array: [u8; Header::SIZE] = box_pack.header.into_array();
let header_array_expected: [u8; Header::SIZE] = [16, 0, 0, 0, 1, 0, 1];
assert_eq!(
header_array,
header_array_expected,
"Header encoding mismatch!",
);

let header_decoded = Header::from_array(header_array_expected);
assert_eq!(
box_pack.header,
header_decoded,
"Header decoding mismatch!",
);
}

0 comments on commit f475f41

Please sign in to comment.