Skip to content

Commit

Permalink
Add test for new option
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianSchmid committed Sep 23, 2024
1 parent 3ebb892 commit 7d62209
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/sd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1608,6 +1608,21 @@ mod tests_sd_option {
let result = SdOption::read(&mut cursor);
assert_matches!(result, Err(SdReadError::UnknownSdOptionType(0xFF)));
}
// unknown option type (non discardable, discard option set)
{
let buffer = [0x00, 0x01, 0xff, 0x00];
let mut cursor = std::io::Cursor::new(buffer);
let (len, header) = SdOption::read_with_flag(&mut cursor, true).unwrap();
assert_eq!(
header,
UnknownDiscardableOption {
length: 1,
option_type: 0xff,
}
.into()
);
assert_eq!(4, len);
}
// unknown option type (discardable)
{
let buffer = [0x00, 0x01, 0xff, 0b1000_0000];
Expand Down

0 comments on commit 7d62209

Please sign in to comment.