Skip to content

Commit

Permalink
Refs #20160: Fixed tests.
Browse files Browse the repository at this point in the history
Signed-off-by: adriancampo <[email protected]>
  • Loading branch information
adriancampo committed Apr 5, 2024
1 parent 6d3bdd2 commit 27a861e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// limitations under the License.

/**
* @file connection_fwd.hpp
* @file connections_fwd.hpp
*
*/

Expand Down
13 changes: 10 additions & 3 deletions src/cpp/fastdds/xtypes/type_representation/TypeObjectRegistry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -693,11 +693,18 @@ const TypeIdentifier TypeObjectRegistry::get_complementary_type_identifier(
std::lock_guard<std::mutex> data_guard(type_object_registry_mutex_);
for (const auto& it : local_type_identifiers_)
{
if (it.second.type_identifier1() == type_id && TK_NONE != it.second.type_identifier2()._d())
if (it.second.type_identifier1() == type_id)
{
return it.second.type_identifier2();
if (TK_NONE != it.second.type_identifier2()._d())
{
return it.second.type_identifier2();
}
else
{
return it.second.type_identifier1();
}
}
else if (it.second.type_identifier2() == type_id || TK_NONE == it.second.type_identifier2()._d())
else if (it.second.type_identifier2() == type_id)
{
return it.second.type_identifier1();
}
Expand Down
5 changes: 3 additions & 2 deletions test/unittest/rtps/builtin/BuiltinDataSerializationTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ TEST(BuiltinDataSerializationTests, ok_with_defaults)
}

// Regression test for redmine issue #10547
// After XTypes1.3 readFromCDRMessage is expected to return false when reading fails
TEST(BuiltinDataSerializationTests, ignore_unsupported_type_info)
{
// DATA(w)
Expand Down Expand Up @@ -189,7 +190,7 @@ TEST(BuiltinDataSerializationTests, ignore_unsupported_type_info)
msg.length = msg.max_size;

WriterProxyData out(max_unicast_locators, max_multicast_locators);
EXPECT_NO_THROW(EXPECT_TRUE(out.readFromCDRMessage(&msg, network, false, true)));
EXPECT_NO_THROW(EXPECT_FALSE(out.readFromCDRMessage(&msg, network, false, true)));
}

// DATA(r)
Expand Down Expand Up @@ -241,7 +242,7 @@ TEST(BuiltinDataSerializationTests, ignore_unsupported_type_info)
msg.length = msg.max_size;

ReaderProxyData out(max_unicast_locators, max_multicast_locators);
EXPECT_NO_THROW(EXPECT_TRUE(out.readFromCDRMessage(&msg, network, false, true)));
EXPECT_NO_THROW(EXPECT_FALSE(out.readFromCDRMessage(&msg, network, false, true)));
}
}

Expand Down

0 comments on commit 27a861e

Please sign in to comment.