Skip to content

Commit ea3a177

Browse files
authored
Merge pull request #587 from elbeno/fix-relop-implies
2 parents ba15d53 + 300cf9b commit ea3a177

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

include/msg/field_matchers.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,8 @@ struct rel_matcher_t {
162162
[[nodiscard]] friend constexpr auto
163163
tag_invoke(match::implies_t, rel_matcher_t,
164164
rel_matcher_t<RelOp, Field, OtherValue>) -> bool {
165-
return RelOp{}(ExpectedValue, OtherValue);
165+
return ExpectedValue == OtherValue or
166+
RelOp{}(ExpectedValue, OtherValue);
166167
}
167168

168169
template <typename Msg>

test/msg/field_matchers.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ TEST_CASE("negate not_equal_to", "[field matchers]") {
5454
std::is_same_v<decltype(n), msg::equal_to_t<test_field, 5> const>);
5555
}
5656

57+
TEST_CASE("less_than X implies less_than Y (X == Y)", "[field matchers]") {
58+
constexpr auto m = msg::less_than_t<test_field, 5>{};
59+
constexpr auto n = msg::less_than_t<test_field, 5>{};
60+
static_assert(match::implies(m, n));
61+
}
62+
5763
TEST_CASE("less_than X implies less_than Y (X <= Y)", "[field matchers]") {
5864
constexpr auto m = msg::less_than_t<test_field, 5>{};
5965
constexpr auto n = msg::less_than_t<test_field, 6>{};

0 commit comments

Comments
 (0)