Skip to content

Commit 4f9d772

Browse files
committed
Add test for using range to filter a const collection
This commit is added in order to test the fix from the previous commit, because it is good to test things.
1 parent 29faa09 commit 4f9d772

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

unit/util/range.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,18 @@ SCENARIO("range tests", "[core][util][range]")
6464
REQUIRE(total == 8);
6565
}
6666
}
67+
GIVEN("A const vector of ints")
68+
{
69+
const std::vector<int> input{1, 2, 3, 4};
70+
THEN("Filter the vector using range.")
71+
{
72+
auto odds_range =
73+
make_range(input).filter([](const int number) { return number % 2; });
74+
const std::vector<int> odds{odds_range.begin(), odds_range.end()};
75+
const std::vector<int> expected_odds{1, 3};
76+
REQUIRE(odds == expected_odds);
77+
}
78+
}
6779
}
6880

6981
class move_onlyt

0 commit comments

Comments
 (0)