Skip to content

Commit

Permalink
chore: rename range::elements to range::each_element
Browse files Browse the repository at this point in the history
  • Loading branch information
DNKpp committed Oct 24, 2024
1 parent 59d8a15 commit be32abe
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions include/mimic++/Matcher.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -932,12 +932,12 @@ namespace mimicpp::matches::range
}

/**
* \brief Tests, whether the all elements of the target range match the specified matcher.
* \brief Tests, whether the each element of the target range matches the specified matcher.
* \param matcher The matcher.
*/
template <typename Matcher>
[[nodiscard]]
constexpr auto elements(Matcher&& matcher)
constexpr auto each_element(Matcher&& matcher)
{
using MatcherT = std::remove_cvref_t<Matcher>;
return PredicateMatcher{
Expand Down
10 changes: 5 additions & 5 deletions test/unit-tests/matchers/RangeMatchers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -424,15 +424,15 @@ TEST_CASE(
}

TEST_CASE(
"matches::range::elements matches when all target elements matches the specified matchers.",
"matches::range::each_element matches when all target elements matches the specified matchers.",
"[matcher][matcher::range]"
)
{
SECTION("Plain matcher.")
{
SECTION("When all elements matches the matcher, it's a match.")
{
const auto matcher = matches::range::elements(matches::ge(42));
const auto matcher = matches::range::each_element(matches::ge(42));
const std::vector target = GENERATE(
std::vector<int>{},
(std::vector{42, 1337}));
Expand All @@ -446,7 +446,7 @@ TEST_CASE(
SECTION("When at least on element does not match the matcher, it's no match.")
{
const auto threshold = GENERATE(42, 1337);
const auto matcher = matches::range::elements(matches::gt(threshold));
const auto matcher = matches::range::each_element(matches::gt(threshold));
const std::vector target{42, 1337};

REQUIRE(!matcher.matches(target));
Expand All @@ -460,7 +460,7 @@ TEST_CASE(
{
SECTION("When all elements matches the matcher, it's no match.")
{
const auto matcher = !matches::range::elements(matches::ge(42));
const auto matcher = !matches::range::each_element(matches::ge(42));
const std::vector target = GENERATE(
std::vector<int>{},
(std::vector{42, 1337}));
Expand All @@ -474,7 +474,7 @@ TEST_CASE(
SECTION("When at least on element does not match the matcher, it's a match.")
{
const auto threshold = GENERATE(42, 1337);
const auto matcher = !matches::range::elements(matches::gt(threshold));
const auto matcher = !matches::range::each_element(matches::gt(threshold));
const std::vector target{42, 1337};

REQUIRE(matcher.matches(target));
Expand Down

0 comments on commit be32abe

Please sign in to comment.