diff --git a/include/fastdds/rtps/builtin/discovery/endpoint/EDP.h b/include/fastdds/rtps/builtin/discovery/endpoint/EDP.h index bcdc927919a..4d8a53a990e 100644 --- a/include/fastdds/rtps/builtin/discovery/endpoint/EDP.h +++ b/include/fastdds/rtps/builtin/discovery/endpoint/EDP.h @@ -71,16 +71,23 @@ class EDP public: //! Bit index for matching failing due to different topic - static const uint32_t different_topic = (0x00000001 << 0u); + static const uint32_t different_topic = 0u; //! Bit index for matching failing due to inconsistent topic (same topic name but different characteristics) - static const uint32_t inconsistent_topic = (0x00000001 << 1u); + static const uint32_t inconsistent_topic = 1u; //! Bit index for matching failing due to incompatible QoS - static const uint32_t incompatible_qos = (0x00000001 << 2u); + static const uint32_t incompatible_qos = 2u; //! Bit index for matching failing due to inconsistent partitions +<<<<<<< HEAD:include/fastdds/rtps/builtin/discovery/endpoint/EDP.h static const uint32_t partitions = (0x00000001 << 3u); +======= + static const uint32_t partitions = 3u; + + //! Bit index for matching failing due to incompatible TypeInformation + static const uint32_t different_typeinfo = 4u; +>>>>>>> 5e1f1dd22 (Correctly initialize `MatchingFailureMask` constants to be used with the `std::bitset` API (#4922)):src/cpp/rtps/builtin/discovery/endpoint/EDP.h }; /** diff --git a/test/unittest/rtps/discovery/EdpTests.cpp b/test/unittest/rtps/discovery/EdpTests.cpp index 930d13ba9dc..b49de5fdcc9 100644 --- a/test/unittest/rtps/discovery/EdpTests.cpp +++ b/test/unittest/rtps/discovery/EdpTests.cpp @@ -434,6 +434,27 @@ TEST_F(EdpTests, CheckDataRepresentationCompatibility) } } +TEST(MatchingFailureMask, matching_failure_mask_overflow) +{ + EDP::MatchingFailureMask mask; + + mask.set(EDP::MatchingFailureMask::different_topic); + EXPECT_TRUE(mask.test(EDP::MatchingFailureMask::different_topic)); + + mask.set(EDP::MatchingFailureMask::inconsistent_topic); + EXPECT_TRUE(mask.test(EDP::MatchingFailureMask::inconsistent_topic)); + + mask.set(EDP::MatchingFailureMask::incompatible_qos); + EXPECT_TRUE(mask.test(EDP::MatchingFailureMask::incompatible_qos)); + + mask.set(EDP::MatchingFailureMask::partitions); + EXPECT_TRUE(mask.test(EDP::MatchingFailureMask::partitions)); + + mask.set(EDP::MatchingFailureMask::different_typeinfo); + EXPECT_TRUE(mask.test(EDP::MatchingFailureMask::different_typeinfo)); +} + + } // namespace rtps } // namespace fastrtps } // namespace eprosima