Merge pull request 'update msg to user module' (#107) from cfdp-msg-to-user-update into main
All checks were successful
Rust/spacepackets/pipeline/head This commit looks good
All checks were successful
Rust/spacepackets/pipeline/head This commit looks good
Reviewed-on: #107
This commit is contained in:
commit
b19a61b859
@ -22,6 +22,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
API to the file data buffer without an intermediate buffer.
|
API to the file data buffer without an intermediate buffer.
|
||||||
- Generic `EofPdu::new` constructor.
|
- Generic `EofPdu::new` constructor.
|
||||||
- Added generic sequence counter module.
|
- Added generic sequence counter module.
|
||||||
|
- Added `MsgToUserTlv::to_tlv` converter which reduced the type and converts
|
||||||
|
it to a generic `Tlv`.
|
||||||
|
|
||||||
## Added and Changed
|
## Added and Changed
|
||||||
|
|
||||||
|
@ -78,6 +78,10 @@ impl<'data> MsgToUserTlv<'data> {
|
|||||||
Ok(msg_to_user)
|
Ok(msg_to_user)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn to_tlv(&self) -> Tlv<'data> {
|
||||||
|
self.tlv
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(feature = "alloc")]
|
#[cfg(feature = "alloc")]
|
||||||
pub fn to_owned(&self) -> TlvOwned {
|
pub fn to_owned(&self) -> TlvOwned {
|
||||||
self.tlv.to_owned()
|
self.tlv.to_owned()
|
||||||
@ -146,6 +150,32 @@ mod tests {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_msg_to_user_type_reduction() {
|
||||||
|
let custom_value: [u8; 4] = [1, 2, 3, 4];
|
||||||
|
let msg_to_user = MsgToUserTlv::new(&custom_value).unwrap();
|
||||||
|
let tlv = msg_to_user.to_tlv();
|
||||||
|
assert_eq!(
|
||||||
|
tlv.tlv_type_field(),
|
||||||
|
TlvTypeField::Standard(TlvType::MsgToUser)
|
||||||
|
);
|
||||||
|
|
||||||
|
assert_eq!(tlv.value(), custom_value);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_msg_to_user_owner_converter() {
|
||||||
|
let custom_value: [u8; 4] = [1, 2, 3, 4];
|
||||||
|
let msg_to_user = MsgToUserTlv::new(&custom_value).unwrap();
|
||||||
|
let tlv = msg_to_user.to_owned();
|
||||||
|
assert_eq!(
|
||||||
|
tlv.tlv_type_field(),
|
||||||
|
TlvTypeField::Standard(TlvType::MsgToUser)
|
||||||
|
);
|
||||||
|
|
||||||
|
assert_eq!(tlv.value(), custom_value);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_reserved_msg_deserialization() {
|
fn test_reserved_msg_deserialization() {
|
||||||
let custom_value: [u8; 3] = [1, 2, 3];
|
let custom_value: [u8; 3] = [1, 2, 3];
|
||||||
|
Loading…
Reference in New Issue
Block a user