-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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!", | ||
); | ||
} |