|
6 | 6 |
|
7 | 7 | \*******************************************************************/
|
8 | 8 |
|
| 9 | +#include <list> |
9 | 10 | #include <vector>
|
10 | 11 |
|
11 | 12 | #include <testing-utils/use_catch.h>
|
@@ -188,6 +189,34 @@ SCENARIO("range tests", "[core][util][range]")
|
188 | 189 | REQUIRE(input2 == expected_result2);
|
189 | 190 | }
|
190 | 191 | }
|
| 192 | + GIVEN("A vectors of int and a list of strings.") |
| 193 | + { |
| 194 | + std::vector<int> int_vector{1, 2}; |
| 195 | + std::list<std::string> string_list{"foo", "bar"}; |
| 196 | + WHEN("We zip the vector and the list") |
| 197 | + { |
| 198 | + auto range = make_range(int_vector).zip(string_list); |
| 199 | + REQUIRE(!range.empty()); |
| 200 | + THEN("First pair is (1, foo)") |
| 201 | + { |
| 202 | + const std::pair<int, std::string> first_pair = *range.begin(); |
| 203 | + REQUIRE(first_pair.first == 1); |
| 204 | + REQUIRE(first_pair.second == "foo"); |
| 205 | + } |
| 206 | + range = std::move(range).drop(1); |
| 207 | + THEN("Second pair is (2, bar)") |
| 208 | + { |
| 209 | + const std::pair<int, std::string> second_pair = *range.begin(); |
| 210 | + REQUIRE(second_pair.first == 2); |
| 211 | + REQUIRE(second_pair.second == "bar"); |
| 212 | + } |
| 213 | + range = std::move(range).drop(1); |
| 214 | + THEN("Range is empty") |
| 215 | + { |
| 216 | + REQUIRE(range.empty()); |
| 217 | + } |
| 218 | + } |
| 219 | + } |
191 | 220 | }
|
192 | 221 |
|
193 | 222 | class move_onlyt
|
|
0 commit comments