small test for TC reader invalid input
Some checks failed
Rust/spacepackets/pipeline/head There was a failure building this commit
Some checks failed
Rust/spacepackets/pipeline/head There was a failure building this commit
This commit is contained in:
parent
c6c80edb84
commit
4945ea804d
@ -30,6 +30,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
`PusError::ByteConversionError` variant.
|
`PusError::ByteConversionError` variant.
|
||||||
- Ranamed `TlvLvError::ByteConversionError` to `TlvLvError::ByteConversion`.
|
- Ranamed `TlvLvError::ByteConversionError` to `TlvLvError::ByteConversion`.
|
||||||
- Renamed `PusError::IncorrectCrc` to `PusError::ChecksumFailure`.
|
- Renamed `PusError::IncorrectCrc` to `PusError::ChecksumFailure`.
|
||||||
|
- Some more struct variant changes for error enumerations.
|
||||||
|
|
||||||
## Removed
|
## Removed
|
||||||
|
|
||||||
|
@ -1233,4 +1233,22 @@ mod tests {
|
|||||||
panic!("unexpected error {error}")
|
panic!("unexpected error {error}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_reader_input_too_small() {
|
||||||
|
let buf: [u8; 5] = [0; 5];
|
||||||
|
let error = PusTcReader::new(&buf);
|
||||||
|
assert!(error.is_err());
|
||||||
|
let error = error.unwrap_err();
|
||||||
|
if let PusError::ByteConversion(ByteConversionError::FromSliceTooSmall {
|
||||||
|
found,
|
||||||
|
expected,
|
||||||
|
}) = error
|
||||||
|
{
|
||||||
|
assert_eq!(found, 5);
|
||||||
|
assert_eq!(expected, PUS_TC_MIN_LEN_WITHOUT_APP_DATA);
|
||||||
|
} else {
|
||||||
|
panic!("unexpected error {error}")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user