fixed a test
Some checks failed
Rust/spacepackets/pipeline/head There was a failure building this commit

This commit is contained in:
Robin Müller 2023-08-17 21:24:12 +02:00
parent c96a86a994
commit f208a9b0f0
Signed by: muellerr
GPG Key ID: A649FB78196E3849

View File

@ -83,10 +83,7 @@ impl Display for PduError {
"cfdp version missmatch, found {raw}, expected {CFDP_VERSION_2}" "cfdp version missmatch, found {raw}, expected {CFDP_VERSION_2}"
) )
} }
PduError::SourceDestIdLenMissmatch { PduError::SourceDestIdLenMissmatch { src_id_len, dest_id_len }=> {
src_id_len,
dest_id_len,
} => {
write!( write!(
f, f,
"missmatch of PDU source length {src_id_len} and destination length {dest_id_len}" "missmatch of PDU source length {src_id_len} and destination length {dest_id_len}"
@ -98,7 +95,7 @@ impl Display for PduError {
PduError::FileSizeTooLarge(value) => { PduError::FileSizeTooLarge(value) => {
write!(f, "file size value {value} exceeds allowed 32 bit width") write!(f, "file size value {value} exceeds allowed 32 bit width")
} }
PduError::WrongDirectiveType { found, expected } => { PduError::WrongDirectiveType { found, expected }=> {
write!(f, "found directive type {found:?}, expected {expected:?}") write!(f, "found directive type {found:?}, expected {expected:?}")
} }
PduError::InvalidConditionCode(raw_code) => { PduError::InvalidConditionCode(raw_code) => {
@ -225,6 +222,7 @@ impl CommonPduConfig {
return Err(PduError::SourceDestIdLenMissmatch { return Err(PduError::SourceDestIdLenMissmatch {
src_id_len: source_id.size(), src_id_len: source_id.size(),
dest_id_len: dest_id.size(), dest_id_len: dest_id.size(),
}); });
} }
if source_id.size() != 1 if source_id.size() != 1
@ -931,9 +929,9 @@ mod tests {
CommonPduConfig::new_with_byte_fields(src_id, dest_id, transaction_seq_id); CommonPduConfig::new_with_byte_fields(src_id, dest_id, transaction_seq_id);
assert!(pdu_conf_res.is_err()); assert!(pdu_conf_res.is_err());
let error = pdu_conf_res.unwrap_err(); let error = pdu_conf_res.unwrap_err();
if let PduError::SourceDestIdLenMissmatch((src_len, dest_len)) = error { if let PduError::SourceDestIdLenMissmatch { src_id_len, dest_id_len }= error {
assert_eq!(src_len, 1); assert_eq!(src_id_len, 1);
assert_eq!(dest_len, 2); assert_eq!(dest_id_len, 2);
} }
} }