Skip to content

Commit 3da7082

Browse files
committed
Add unit test on range.map over a const container
Given that `filter` and `concat` didn't work with const input collections, it seems prudent to test that `map` works with const input collections as well. There is no corresponding fix to make this test pass in this PR.
1 parent 256fd81 commit 3da7082

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

unit/util/range.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,15 @@ SCENARIO("range tests", "[core][util][range]")
9595
{
9696
REQUIRE(front(make_range(input)) == 1);
9797
}
98+
THEN("Map over the vector using range.")
99+
{
100+
const auto plus_one_range =
101+
make_range(input).map([](const int number) { return number + 1; });
102+
const std::vector<int> plus_one_collection{plus_one_range.begin(),
103+
plus_one_range.end()};
104+
const std::vector<int> expected_output{2, 3, 4, 5};
105+
REQUIRE(plus_one_collection == expected_output);
106+
};
98107
}
99108
GIVEN("Two const vectors of ints")
100109
{

0 commit comments

Comments
 (0)