fix tests

This commit is contained in:
Robin Müller 2023-07-06 00:58:25 +02:00
parent f7bf4a4d7b
commit 28240da002
Signed by: muellerr
GPG Key ID: A649FB78196E3849
4 changed files with 19 additions and 26 deletions

View File

@ -18,6 +18,7 @@ use std::vec::Vec;
/// ///
/// ``` /// ```
/// use std::net::{IpAddr, Ipv4Addr, SocketAddr, UdpSocket}; /// use std::net::{IpAddr, Ipv4Addr, SocketAddr, UdpSocket};
/// use spacepackets::ecss::SerializablePusPacket;
/// use satrs_core::hal::host::udp_server::UdpTcServer; /// use satrs_core::hal::host::udp_server::UdpTcServer;
/// use satrs_core::tmtc::{ReceivesTc, ReceivesTcCore}; /// use satrs_core::tmtc::{ReceivesTc, ReceivesTcCore};
/// use spacepackets::SpHeader; /// use spacepackets::SpHeader;

View File

@ -29,8 +29,8 @@
//! let pool_cfg = PoolCfg::new(vec![(10, 32), (10, 64), (10, 128), (10, 1024)]); //! let pool_cfg = PoolCfg::new(vec![(10, 32), (10, 64), (10, 128), (10, 1024)]);
//! let shared_tm_pool: SharedPool = Arc::new(RwLock::new(Box::new(LocalPool::new(pool_cfg.clone())))); //! let shared_tm_pool: SharedPool = Arc::new(RwLock::new(Box::new(LocalPool::new(pool_cfg.clone()))));
//! let (verif_tx, verif_rx) = mpsc::channel(); //! let (verif_tx, verif_rx) = mpsc::channel();
//! let sender = MpscVerifSender::new(shared_tm_pool.clone(), verif_tx); //! let sender = MpscVerifSender::new(0, "Test Sender", shared_tm_pool.clone(), verif_tx);
//! let cfg = VerificationReporterCfg::new(TEST_APID, Box::new(SeqCountProviderSimple::default()), Box::new(SeqCountProviderSimple::default()), 1, 2, 8).unwrap(); //! let cfg = VerificationReporterCfg::new(TEST_APID, 1, 2, 8).unwrap();
//! let mut reporter = VerificationReporterWithSender::new(&cfg , Box::new(sender)); //! let mut reporter = VerificationReporterWithSender::new(&cfg , Box::new(sender));
//! //!
//! let mut sph = SpHeader::tc_unseg(TEST_APID, 0, 0).unwrap(); //! let mut sph = SpHeader::tc_unseg(TEST_APID, 0, 0).unwrap();
@ -939,7 +939,7 @@ mod alloc_mod {
/// Primary verification handler. It provides an API to send PUS 1 verification telemetry packets /// Primary verification handler. It provides an API to send PUS 1 verification telemetry packets
/// and verify the various steps of telecommand handling as specified in the PUS standard. /// and verify the various steps of telecommand handling as specified in the PUS standard.
/// It is assumed that the sequence counter and message counters are written in a central /// It is assumed that the sequence counter and message counters are updated in a central
/// TM funnel. This helper will always set those fields to 0. /// TM funnel. This helper will always set those fields to 0.
#[derive(Clone)] #[derive(Clone)]
pub struct VerificationReporter { pub struct VerificationReporter {
@ -1795,7 +1795,7 @@ mod tests {
common: CommonTmInfo { common: CommonTmInfo {
subservice: 4, subservice: 4,
apid: TEST_APID, apid: TEST_APID,
msg_counter: 1, msg_counter: 0,
dest_id: 0, dest_id: 0,
time_stamp: EMPTY_STAMP, time_stamp: EMPTY_STAMP,
}, },
@ -1874,7 +1874,7 @@ mod tests {
common: CommonTmInfo { common: CommonTmInfo {
subservice: 3, subservice: 3,
apid: TEST_APID, apid: TEST_APID,
msg_counter: 1, msg_counter: 0,
dest_id: 0, dest_id: 0,
time_stamp: [0, 1, 0, 1, 0, 1, 0], time_stamp: [0, 1, 0, 1, 0, 1, 0],
}, },
@ -1887,7 +1887,7 @@ mod tests {
common: CommonTmInfo { common: CommonTmInfo {
subservice: 5, subservice: 5,
apid: TEST_APID, apid: TEST_APID,
msg_counter: 2, msg_counter: 0,
dest_id: 0, dest_id: 0,
time_stamp: EMPTY_STAMP, time_stamp: EMPTY_STAMP,
}, },
@ -1900,7 +1900,7 @@ mod tests {
common: CommonTmInfo { common: CommonTmInfo {
subservice: 5, subservice: 5,
apid: TEST_APID, apid: TEST_APID,
msg_counter: 3, msg_counter: 0,
dest_id: 0, dest_id: 0,
time_stamp: EMPTY_STAMP, time_stamp: EMPTY_STAMP,
}, },
@ -1992,7 +1992,7 @@ mod tests {
common: CommonTmInfo { common: CommonTmInfo {
subservice: 3, subservice: 3,
apid: TEST_APID, apid: TEST_APID,
msg_counter: 1, msg_counter: 0,
dest_id: 0, dest_id: 0,
time_stamp: [0, 1, 0, 1, 0, 1, 0], time_stamp: [0, 1, 0, 1, 0, 1, 0],
}, },
@ -2006,7 +2006,7 @@ mod tests {
common: CommonTmInfo { common: CommonTmInfo {
subservice: 5, subservice: 5,
apid: TEST_APID, apid: TEST_APID,
msg_counter: 2, msg_counter: 0,
dest_id: 0, dest_id: 0,
time_stamp: EMPTY_STAMP, time_stamp: EMPTY_STAMP,
}, },
@ -2020,7 +2020,7 @@ mod tests {
common: CommonTmInfo { common: CommonTmInfo {
subservice: 6, subservice: 6,
apid: TEST_APID, apid: TEST_APID,
msg_counter: 3, msg_counter: 0,
dest_id: 0, dest_id: 0,
time_stamp: EMPTY_STAMP, time_stamp: EMPTY_STAMP,
}, },
@ -2137,7 +2137,7 @@ mod tests {
common: CommonTmInfo { common: CommonTmInfo {
subservice: 3, subservice: 3,
apid: TEST_APID, apid: TEST_APID,
msg_counter: 1, msg_counter: 0,
dest_id: 0, dest_id: 0,
time_stamp: [0, 1, 0, 1, 0, 1, 0], time_stamp: [0, 1, 0, 1, 0, 1, 0],
}, },
@ -2151,7 +2151,7 @@ mod tests {
common: CommonTmInfo { common: CommonTmInfo {
subservice: 8, subservice: 8,
apid: TEST_APID, apid: TEST_APID,
msg_counter: 2, msg_counter: 0,
dest_id: 0, dest_id: 0,
time_stamp: EMPTY_STAMP, time_stamp: EMPTY_STAMP,
}, },
@ -2227,7 +2227,7 @@ mod tests {
common: CommonTmInfo { common: CommonTmInfo {
subservice: 3, subservice: 3,
apid: TEST_APID, apid: TEST_APID,
msg_counter: 1, msg_counter: 0,
dest_id: 0, dest_id: 0,
time_stamp: [0, 1, 0, 1, 0, 1, 0], time_stamp: [0, 1, 0, 1, 0, 1, 0],
}, },
@ -2240,7 +2240,7 @@ mod tests {
common: CommonTmInfo { common: CommonTmInfo {
subservice: 7, subservice: 7,
apid: TEST_APID, apid: TEST_APID,
msg_counter: 2, msg_counter: 0,
dest_id: 0, dest_id: 0,
time_stamp: EMPTY_STAMP, time_stamp: EMPTY_STAMP,
}, },
@ -2336,10 +2336,10 @@ mod tests {
assert_eq!(pus_tm.sp_header.seq_count(), 0); assert_eq!(pus_tm.sp_header.seq_count(), 0);
} else if packet_idx == 1 { } else if packet_idx == 1 {
assert_eq!(pus_tm.subservice(), 3); assert_eq!(pus_tm.subservice(), 3);
assert_eq!(pus_tm.sp_header.seq_count(), 1); assert_eq!(pus_tm.sp_header.seq_count(), 0);
} else if packet_idx == 2 { } else if packet_idx == 2 {
assert_eq!(pus_tm.subservice(), 7); assert_eq!(pus_tm.subservice(), 7);
assert_eq!(pus_tm.sp_header.seq_count(), 2); assert_eq!(pus_tm.sp_header.seq_count(), 0);
} }
packet_idx += 1; packet_idx += 1;
} }

View File

@ -21,6 +21,7 @@
//! use satrs_core::tmtc::ccsds_distrib::{CcsdsPacketHandler, CcsdsDistributor}; //! use satrs_core::tmtc::ccsds_distrib::{CcsdsPacketHandler, CcsdsDistributor};
//! use satrs_core::tmtc::{ReceivesTc, ReceivesTcCore}; //! use satrs_core::tmtc::{ReceivesTc, ReceivesTcCore};
//! use spacepackets::{CcsdsPacket, SpHeader}; //! use spacepackets::{CcsdsPacket, SpHeader};
//! use spacepackets::ecss::SerializablePusPacket;
//! use spacepackets::tc::PusTc; //! use spacepackets::tc::PusTc;
//! //!
//! #[derive (Default)] //! #[derive (Default)]

View File

@ -7,7 +7,6 @@ pub mod crossbeam_test {
CrossbeamVerifSender, FailParams, RequestId, VerificationReporterCfg, CrossbeamVerifSender, FailParams, RequestId, VerificationReporterCfg,
VerificationReporterWithSender, VerificationReporterWithSender,
}; };
use satrs_core::seq_count::SeqCountProviderSyncClonable;
use spacepackets::ecss::{EcssEnumU16, EcssEnumU8, PusPacket, SerializablePusPacket}; use spacepackets::ecss::{EcssEnumU16, EcssEnumU8, PusPacket, SerializablePusPacket};
use spacepackets::tc::{PusTc, PusTcSecondaryHeader}; use spacepackets::tc::{PusTc, PusTcSecondaryHeader};
use spacepackets::tm::PusTm; use spacepackets::tm::PusTm;
@ -32,15 +31,7 @@ pub mod crossbeam_test {
// We use a synced sequence count provider here because both verification reporters have the // We use a synced sequence count provider here because both verification reporters have the
// the same APID. If they had distinct APIDs, the more correct approach would be to have // the same APID. If they had distinct APIDs, the more correct approach would be to have
// each reporter have an own sequence count provider. // each reporter have an own sequence count provider.
let cfg = VerificationReporterCfg::new( let cfg = VerificationReporterCfg::new(TEST_APID, 1, 2, 8).unwrap();
TEST_APID,
Box::new(SeqCountProviderSyncClonable::default()),
Box::new(SeqCountProviderSyncClonable::default()),
1,
2,
8,
)
.unwrap();
// Shared pool object to store the verification PUS telemetry // Shared pool object to store the verification PUS telemetry
let pool_cfg = PoolCfg::new(vec![(10, 32), (10, 64), (10, 128), (10, 1024)]); let pool_cfg = PoolCfg::new(vec![(10, 32), (10, 64), (10, 128), (10, 1024)]);
let shared_tm_pool: SharedPool = let shared_tm_pool: SharedPool =