From 5fb74825656e2504e693a8457c63e84134f3e44c Mon Sep 17 00:00:00 2001 From: lurchi Date: Sun, 4 Sep 2016 17:44:55 +0200 Subject: [PATCH] improves packet_id test --- rust/tests/test_packet_id.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/rust/tests/test_packet_id.rs b/rust/tests/test_packet_id.rs index 7b50eb8..58e822c 100644 --- a/rust/tests/test_packet_id.rs +++ b/rust/tests/test_packet_id.rs @@ -33,9 +33,17 @@ fn test_packet_id() { 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|"; - 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); }