From 0609863127ce08e7624e593548a8052e452cbdb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Jos=C3=A9=20Pereira?= Date: Wed, 17 Apr 2024 10:24:12 -0300 Subject: [PATCH] tests: packer: Add message_id test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Patrick José Pereira --- tests/packer.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/packer.rs b/tests/packer.rs index fe28a62c7..a83052793 100644 --- a/tests/packer.rs +++ b/tests/packer.rs @@ -1,5 +1,5 @@ use ping_rs::common::{self, Messages as common_messages}; -use ping_rs::message::ProtocolMessage; +use ping_rs::message::{MessageInfo, PingMessage, ProtocolMessage}; #[test] fn test_same_packer() { @@ -26,10 +26,15 @@ fn test_same_packer() { ); general_request.requested_id = 1211; - packer.set_message(&common_messages::GeneralRequest(general_request)); + packer.set_message(&common_messages::GeneralRequest(general_request.clone())); packer.set_dst_device_id(0); assert_eq!( packer.serialized(), [0x42, 0x52, 0x02, 0x00, 0x06, 0x00, 0x00, 0x00, 0xbb, 0x04, 0x5b, 0x01] ); + + assert_eq!( + common::GeneralRequestStruct::id(), + common_messages::GeneralRequest(general_request).message_id() + ); }