Skip to content

Commit

Permalink
Refs #20933: Add tests
Browse files Browse the repository at this point in the history
Signed-off-by: elianalf <[email protected]>
  • Loading branch information
elianalf committed May 13, 2024
1 parent c524bf2 commit 5ca4a18
Showing 1 changed file with 84 additions and 0 deletions.
84 changes: 84 additions & 0 deletions test/unittest/rtps/builtin/BuiltinDataSerializationTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,90 @@ TEST(BuiltinDataSerializationTests, ok_with_defaults)
}
}

TEST(BuiltinDataSerializationTests, msg_without_datasharing)
{
{
// This was captured with wireshark from OpenDDS iShapes 3.16
uint8_t data_r_buffer[] =
{
// Encapsulation
0x00, 0x03, 0x00, 0x00
};

CDRMessage_t msg(0);
msg.init(data_r_buffer, static_cast<uint32_t>(sizeof(data_r_buffer)));
msg.length = msg.max_size;

ReaderProxyData out(max_unicast_locators, max_multicast_locators);
out.readFromCDRMessage(&msg, network, false, true);
ASSERT_EQ(out.m_qos.data_sharing.kind(), OFF);
}

{
// This was captured with wireshark from OpenDDS iShapes 3.16
uint8_t data_w_buffer[] =
{
// Encapsulation
0x00, 0x03, 0x00, 0x00

};

CDRMessage_t msg(0);
msg.init(data_w_buffer, static_cast<uint32_t>(sizeof(data_w_buffer)));
msg.length = msg.max_size;

ReaderProxyData out(max_unicast_locators, max_multicast_locators);
out.readFromCDRMessage(&msg, network, false, true);
ASSERT_EQ(out.m_qos.data_sharing.kind(), OFF);
}
}

TEST(BuiltinDataSerializationTests, msg_with_datasharing)
{
{
// This was captured with wireshark from OpenDDS iShapes 3.16
uint8_t data_r_buffer[] =
{
// Encapsulation
0x00, 0x03, 0x00, 0x00,
//Data Sharing
0x06, 0x80, 0x0c, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6c, 0x9b, 0xf9, 0xbe, 0x1c, 0xb8

};

CDRMessage_t msg(0);
msg.init(data_r_buffer, static_cast<uint32_t>(sizeof(data_r_buffer)));
msg.length = msg.max_size;

ReaderProxyData out(max_unicast_locators, max_multicast_locators);
out.readFromCDRMessage(&msg, network, false, true);
ASSERT_EQ(out.m_qos.data_sharing.kind(), ON);
}

{
// This was captured with wireshark from OpenDDS iShapes 3.16
uint8_t data_w_buffer[] =
{
// Encapsulation
0x00, 0x03, 0x00, 0x00,
//Data Sharing
0x06, 0x80, 0x0c, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6c, 0x9b, 0xf9, 0xbe, 0x1c, 0xb8

};

CDRMessage_t msg(0);
msg.init(data_w_buffer, static_cast<uint32_t>(sizeof(data_w_buffer)));
msg.length = msg.max_size;

ReaderProxyData out(max_unicast_locators, max_multicast_locators);
out.readFromCDRMessage(&msg, network, false, true);
ASSERT_EQ(out.m_qos.data_sharing.kind(), ON);
}
}


// Regression test for redmine issue #10547.
// Update against OpenDDS 3.27. With this version we can read the remote DATA(w).
TEST(BuiltinDataSerializationTests, interoperability_with_opendds_3_27)
Expand Down

0 comments on commit 5ca4a18

Please sign in to comment.