add some tests
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
6ebdf7e330
commit
6116cdb27c
20
src/lib.rs
20
src/lib.rs
@ -743,6 +743,8 @@ pub mod zc {
|
|||||||
|
|
||||||
#[cfg(all(test, feature = "std"))]
|
#[cfg(all(test, feature = "std"))]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
use std::collections::HashSet;
|
||||||
|
|
||||||
#[cfg(feature = "serde")]
|
#[cfg(feature = "serde")]
|
||||||
use crate::CcsdsPrimaryHeader;
|
use crate::CcsdsPrimaryHeader;
|
||||||
use crate::{
|
use crate::{
|
||||||
@ -1056,4 +1058,22 @@ mod tests {
|
|||||||
assert_eq!(sp_header.ptype(), PacketType::Tc);
|
assert_eq!(sp_header.ptype(), PacketType::Tc);
|
||||||
assert_eq!(sp_header.data_len(), 0);
|
assert_eq!(sp_header.data_len(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn packet_id_ord_partial_ord() {
|
||||||
|
let packet_id_small = PacketId::from(1_u16);
|
||||||
|
let packet_id_larger = PacketId::from(2_u16);
|
||||||
|
assert!(packet_id_small < packet_id_larger);
|
||||||
|
assert!(packet_id_larger > packet_id_small);
|
||||||
|
assert_eq!(
|
||||||
|
packet_id_small.cmp(&packet_id_larger),
|
||||||
|
core::cmp::Ordering::Less
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn packet_id_hashable() {
|
||||||
|
let mut id_set = HashSet::new();
|
||||||
|
id_set.insert(PacketId::from(1_u16));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user