1
0
Fork 0
mirror of git://git.psyc.eu/libpsyc synced 2024-08-15 03:19:02 +00:00

improves packet_id test

This commit is contained in:
lurchi 2016-09-04 17:44:55 +02:00
parent dfe9ba6a0b
commit 5fb7482565

View file

@ -33,9 +33,17 @@ fn test_packet_id() {
fragment: None fragment: None
}; };
assert_eq!(packet.packet_id(), expected_id); let packet_id = packet.packet_id();
assert_eq!(packet_id, expected_id);
let expected_rendered = b"|| psyc://ve.symlynx.com/~alice| psyc://ve.symlynx.com/~bob| 42|"; let expected_rendered = b"|| psyc://ve.symlynx.com/~alice| psyc://ve.symlynx.com/~bob| 42|";
assert_eq!(packet.packet_id().render(), expected_rendered.to_vec()); let rendered_id = packet_id.render();
assert_eq!(rendered_id, expected_rendered.to_vec());
let parsed_id = PacketId::from_bytes(&rendered_id);
assert_eq!(parsed_id.unwrap(), packet_id);
} }