diff options
Diffstat (limited to 'tests/protocol_unittest.cpp')
-rw-r--r-- | tests/protocol_unittest.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/protocol_unittest.cpp b/tests/protocol_unittest.cpp index 76de58b..abbd86b 100644 --- a/tests/protocol_unittest.cpp +++ b/tests/protocol_unittest.cpp @@ -33,6 +33,27 @@ namespace wifilogd { // 2. We need to maintain compatibility with older clients talking to // newer versions of wifilogd. +TEST(ProtocolTest, AsciiMessageChainingWorks) { + using protocol::AsciiMessage; + uint8_t tagLen = 3; + uint16_t dataLen = 7; + const auto ascii_message_header = + AsciiMessage().set_tag_len(tagLen).set_data_len(dataLen); + EXPECT_EQ(tagLen, ascii_message_header.tag_len); + EXPECT_EQ(dataLen, ascii_message_header.data_len); +} + +TEST(ProtocolTest, AsciiMessageNonChainingWorks) { + using protocol::AsciiMessage; + uint8_t tagLen = 3; + uint16_t dataLen = 7; + AsciiMessage ascii_message_header = AsciiMessage(); + ascii_message_header.set_tag_len(tagLen); + ascii_message_header.set_data_len(dataLen); + EXPECT_EQ(tagLen, ascii_message_header.tag_len); + EXPECT_EQ(dataLen, ascii_message_header.data_len); +} + TEST(ProtocolTest, AsciiMessageLayoutIsUnchanged) { using protocol::AsciiMessage; ASSERT_TRUE(std::is_standard_layout<AsciiMessage>::value); |