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 {
|
impl RemoteEntityConfigProvider for RemoteEntityConfig {
|
||||||
fn get(&self, _remote_id: u64) -> Option<&RemoteEntityConfig> {
|
fn get(&self, remote_id: u64) -> Option<&RemoteEntityConfig> {
|
||||||
Some(self)
|
if remote_id == self.entity_id.value() {
|
||||||
|
return Some(self);
|
||||||
|
}
|
||||||
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_mut(&mut self, _remote_id: u64) -> Option<&mut RemoteEntityConfig> {
|
fn get_mut(&mut self, remote_id: u64) -> Option<&mut RemoteEntityConfig> {
|
||||||
Some(self)
|
if remote_id == self.entity_id.value() {
|
||||||
|
return Some(self);
|
||||||
|
}
|
||||||
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
fn add_config(&mut self, _cfg: &RemoteEntityConfig) -> bool {
|
fn add_config(&mut self, _cfg: &RemoteEntityConfig) -> bool {
|
||||||
@ -891,6 +897,7 @@ pub(crate) mod tests {
|
|||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
pub const LOCAL_ID: UnsignedByteFieldU16 = UnsignedByteFieldU16::new(1);
|
pub const LOCAL_ID: UnsignedByteFieldU16 = UnsignedByteFieldU16::new(1);
|
||||||
|
pub const REMOTE_ID: UnsignedByteFieldU16 = UnsignedByteFieldU16::new(2);
|
||||||
|
|
||||||
pub struct FileSegmentRecvdParamsNoSegMetadata {
|
pub struct FileSegmentRecvdParamsNoSegMetadata {
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
@ -1237,6 +1244,20 @@ pub(crate) mod tests {
|
|||||||
assert_eq!(check_timer.expiry_time_seconds(), 1);
|
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]
|
#[test]
|
||||||
fn dummy_fault_hook_test() {
|
fn dummy_fault_hook_test() {
|
||||||
let mut user_hook_dummy = DummyFaultHook::default();
|
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::{
|
use std::{
|
||||||
fs::OpenOptions,
|
fs::OpenOptions,
|
||||||
io::Write,
|
io::Write,
|
||||||
|
Loading…
Reference in New Issue
Block a user