Skip to content

Commit

Permalink
Refs #21385: Edit check_serialization_deserialization() key hash comp…
Browse files Browse the repository at this point in the history
…are conditions. Let compare n bytes only

Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com>
  • Loading branch information
Mario-DL committed Aug 1, 2024
1 parent f816a94 commit d8d2610
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions test/feature/dynamic_types/DynamicTypesDDSTypesTest.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ class DynamicTypesDDSTypesTest : public ::testing::Test
DynamicData::_ref_type& data,
DataRepresentationId data_representation,
static_data& data_static,
static_pubsub& static_pubsubType)
static_pubsub& static_pubsubType,
uint8_t ihandle_bytes_to_compare = rtps::RTPS_KEY_HASH_SIZE)
{
TypeSupport dyn_pubsubType {new DynamicPubSubType(type)};

Expand Down Expand Up @@ -143,7 +144,10 @@ class DynamicTypesDDSTypesTest : public ::testing::Test
ASSERT_TRUE(static_pubsubType.compute_key(&data_static, static_ih));
ASSERT_TRUE(dyn_pubsubType.compute_key(&data, dyn_ih));
EXPECT_NE(static_ih, eprosima::fastdds::dds::InstanceHandle_t());
EXPECT_EQ(static_ih, dyn_ih);
// Big endian target
const rtps::octet* static_ih_start = static_ih.value + rtps::RTPS_KEY_HASH_SIZE - ihandle_bytes_to_compare;
const rtps::octet* dyn_ih_start = dyn_ih.value + rtps::RTPS_KEY_HASH_SIZE - ihandle_bytes_to_compare;
ASSERT_EQ(memcmp(static_ih_start, dyn_ih_start, ihandle_bytes_to_compare), 0);
}

EXPECT_EQ(DynamicDataFactory::get_instance()->delete_data(data1), RETCODE_OK);
Expand Down

0 comments on commit d8d2610

Please sign in to comment.