added a few additional tests
All checks were successful
Rust/spacepackets/pipeline/head This commit looks good
Rust/spacepackets/pipeline/pr-main This commit looks good

This commit is contained in:
Robin Müller 2023-08-16 16:36:15 +02:00
parent 83db710950
commit 4e2c0f1aa7
Signed by: muellerr
GPG Key ID: FCE0B2BD2195142F
2 changed files with 5 additions and 2 deletions

View File

@ -230,6 +230,8 @@ pub mod tests {
assert!(!lv.is_empty());
assert_eq!(lv.len_value(), 4);
assert_eq!(lv.len_full(), 5);
assert!(lv.raw_data().is_some());
assert_eq!(lv.raw_data().unwrap(), buf);
let val = lv.value();
assert_eq!(val[0], 1);
assert_eq!(val[1], 2);

View File

@ -508,16 +508,17 @@ mod tests {
assert!(entity_id.write_to_be_bytes(&mut buf[2..]).is_ok());
buf[0] = TlvType::EntityId as u8;
buf[1] = 1;
let tlv_from_raw = Tlv::from_bytes(&mut buf);
let tlv_from_raw = Tlv::from_bytes(&buf);
assert!(tlv_from_raw.is_ok());
let tlv_from_raw = tlv_from_raw.unwrap();
assert!(tlv_from_raw.raw_data().is_some());
assert_eq!(tlv_from_raw.raw_data().unwrap(), buf);
assert_eq!(
tlv_from_raw.tlv_type_field(),
TlvTypeField::Standard(TlvType::EntityId)
);
assert_eq!(tlv_from_raw.len_value(), 1);
assert_eq!(tlv_from_raw.len_full(), 3);
assert!(tlv_from_raw.value().len() > 0);
assert_eq!(tlv_from_raw.value()[0], 5);
}