Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[21165] Correctly initialize MatchingFailureMask constants to be used with the std::bitset API (backport #4922) #4928

Merged
merged 2 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions include/fastdds/rtps/builtin/discovery/endpoint/EDP.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,16 @@ 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
static const uint32_t partitions = (0x00000001 << 3u);
static const uint32_t partitions = 3u;
};

/**
Expand Down
17 changes: 17 additions & 0 deletions test/unittest/rtps/discovery/EdpTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,23 @@ TEST_F(EdpTests, CheckPositiveAckCompatibility)
}
}

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));
}

} // namespace rtps
} // namespace fastrtps
} // namespace eprosima
Expand Down
Loading