use crate::types::response::{BatchItem, MessageExtension, QueryResponsePayload, ServerInformation, VendorExtension};
#[test]
fn test_deserialize_arbitrary_server_information() {
let fragment_hex = concat!(
"42007C 01 00000028", " 420088 01 00000020", " 123456 07 00000003 00010200 00000000", " 999999 02 00000004 00000099 00000000", );
let fragment_hex = fragment_hex.replace(" ", "");
let ttlv_wire = hex::decode(fragment_hex).unwrap();
let (res, rest) = crate::ttlv::from_slice(&ttlv_wire, QueryResponsePayload::fast_scan).unwrap();
assert!(rest.is_empty());
assert_eq!(res.server_information, Some(ServerInformation));
}
#[test]
fn test_batch_item_vendor_extensions() {
let fragment_hex = concat!(
"42000F 01 00000048", " 42007F 05 00000004 00000001 00000000", " 420051 01 00000030", " 42007D 07 00000003 01020300 00000000", " 420026 06 00000008 00000000 00000001", " 42009C 01 00000008 00000000 00000000", );
let fragment_hex = fragment_hex.replace(" ", "");
let ttlv_wire = hex::decode(fragment_hex).unwrap();
let (batch_item, rest) = crate::ttlv::from_slice(&ttlv_wire, BatchItem::fast_scan).unwrap();
assert!(rest.is_empty());
assert!(matches!(batch_item.message_extension, Some(MessageExtension { .. })));
let me = batch_item.message_extension.unwrap();
assert_eq!(me.vendor_identification, "\u{01}\u{02}\u{03}");
assert!(me.criticality_indicator);
assert_eq!(me.vendor_extension, VendorExtension);
}