Skip to content

Commit 547c7cf

Browse files
iox-#2426 Fix comparison operator in channel.inl
1 parent dfd0390 commit 547c7cf

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

iceoryx_posh/include/iceoryx_posh/gateway/channel.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
#include "iceoryx_posh/iceoryx_posh_types.hpp"
2323
#include "iox/expected.hpp"
2424
#include "iox/fixed_position_container.hpp"
25-
#include "iox/optional.hpp"
2625

2726
#include <memory>
2827

iceoryx_posh/include/iceoryx_posh/internal/gateway/channel.inl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ template <typename IceoryxTerminal, typename ExternalTerminal>
5050
constexpr inline bool Channel<IceoryxTerminal, ExternalTerminal>::operator==(
5151
const Channel<IceoryxTerminal, ExternalTerminal>& rhs) const noexcept
5252
{
53-
return m_service == rhs.getService();
53+
return m_service == rhs.getServiceDescription();
5454
}
5555

5656
template <typename IceoryxTerminal, typename ExternalTerminal>

iceoryx_posh/test/moduletests/test_gw_channel.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,18 @@ TEST_F(ChannelTest, ReturnsErrorIfPoolExhausted)
6262
EXPECT_FALSE(channel.has_error());
6363
}
6464

65+
TEST_F(ChannelTest, ComparisonWorks)
66+
{
67+
::testing::Test::RecordProperty("TEST_ID", "535de22b-575d-467c-810a-6beced4d4144");
68+
auto channel1 = iox::gw::Channel<StubbedIceoryxTerminal, StubbedExternalTerminal>::create(
69+
{"", "", ""}, StubbedIceoryxTerminal::Options());
70+
ASSERT_FALSE(channel1.has_error());
71+
EXPECT_TRUE(channel1 == channel1);
72+
73+
auto channel2 = iox::gw::Channel<StubbedIceoryxTerminal, StubbedExternalTerminal>::create(
74+
{"Service", "", ""}, StubbedIceoryxTerminal::Options());
75+
ASSERT_FALSE(channel2.has_error());
76+
EXPECT_FALSE(channel1 == channel2);
77+
}
78+
6579
} // namespace

0 commit comments

Comments
 (0)