add some more tests
Some checks failed
Rust/cfdp/pipeline/head There was a failure building this commit
Some checks failed
Rust/cfdp/pipeline/head There was a failure building this commit
This commit is contained in:
parent
53078b5760
commit
8ea50f0a9a
29
src/lib.rs
29
src/lib.rs
@ -271,12 +271,18 @@ impl RemoteEntityConfigProvider for alloc::vec::Vec<RemoteEntityConfig> {
|
||||
}
|
||||
|
||||
impl RemoteEntityConfigProvider for RemoteEntityConfig {
|
||||
fn get(&self, _remote_id: u64) -> Option<&RemoteEntityConfig> {
|
||||
Some(self)
|
||||
fn get(&self, remote_id: u64) -> Option<&RemoteEntityConfig> {
|
||||
if remote_id == self.entity_id.value() {
|
||||
return Some(self);
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
fn get_mut(&mut self, _remote_id: u64) -> Option<&mut RemoteEntityConfig> {
|
||||
Some(self)
|
||||
fn get_mut(&mut self, remote_id: u64) -> Option<&mut RemoteEntityConfig> {
|
||||
if remote_id == self.entity_id.value() {
|
||||
return Some(self);
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
fn add_config(&mut self, _cfg: &RemoteEntityConfig) -> bool {
|
||||
@ -891,6 +897,7 @@ pub(crate) mod tests {
|
||||
use super::*;
|
||||
|
||||
pub const LOCAL_ID: UnsignedByteFieldU16 = UnsignedByteFieldU16::new(1);
|
||||
pub const REMOTE_ID: UnsignedByteFieldU16 = UnsignedByteFieldU16::new(2);
|
||||
|
||||
pub struct FileSegmentRecvdParamsNoSegMetadata {
|
||||
#[allow(dead_code)]
|
||||
@ -1237,6 +1244,20 @@ pub(crate) mod tests {
|
||||
assert_eq!(check_timer.expiry_time_seconds(), 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_remote_cfg_provider_single() {
|
||||
let remote_entity_cfg = RemoteEntityConfig::new_with_default_values(
|
||||
REMOTE_ID.into(),
|
||||
1024,
|
||||
true,
|
||||
false,
|
||||
TransmissionMode::Unacknowledged,
|
||||
ChecksumType::Crc32,
|
||||
);
|
||||
let remote_entity_retrieved = remote_entity_cfg.get(REMOTE_ID.value()).unwrap();
|
||||
ssert_eq!(remote_entity_retrieved.entity_id, REMOTE_ID.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn dummy_fault_hook_test() {
|
||||
let mut user_hook_dummy = DummyFaultHook::default();
|
||||
|
@ -1,3 +1,4 @@
|
||||
//! This is an end-to-end integration tests using the CFDP abstractions provided by the library.
|
||||
use std::{
|
||||
fs::OpenOptions,
|
||||
io::Write,
|
||||
|
Loading…
Reference in New Issue
Block a user