Skip to content

Commit 2e69526

Browse files
fix test
1 parent 02bdf6c commit 2e69526

File tree

2 files changed

+31
-33
lines changed

2 files changed

+31
-33
lines changed

libcxx/test/std/ranges/range.adaptors/range.concat/iterator/arithmetic.pass.cpp

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
// operator>=(x, y)
2121
// operator>(x, y)
2222
// operator<=>(x, y)
23-
// operator==(x, y)
24-
// operator==(x, sentinel)
2523

2624
#include <array>
2725
#include <concepts>
@@ -219,33 +217,6 @@ constexpr bool test() {
219217
assert((ci <=> cj) < 0);
220218
}
221219

222-
{
223-
// operator==(x, sentinel)
224-
std::array<int, 2> arr_a{1, 2};
225-
std::array<int, 2> arr_b{3, 4};
226-
std::span<const int> s1{arr_a};
227-
std::span<const int> s2{arr_b};
228-
auto v = std::views::concat(s1, s2);
229-
230-
auto it = v.begin();
231-
assert(!(it == std::default_sentinel_t{}));
232-
233-
it++;
234-
it++;
235-
it++;
236-
it++;
237-
assert(it == std::default_sentinel_t{});
238-
239-
// const-iterator
240-
const auto& cv = v;
241-
auto cit = cv.begin();
242-
++cit;
243-
++cit;
244-
++cit;
245-
++cit;
246-
assert(cit == std::default_sentinel_t{});
247-
}
248-
249220
{
250221
// operator+(x, n) and operator+(n, x), where n is negative
251222
std::array<int, 4> arr_a{1, 2, 3, 4};

libcxx/test/std/ranges/range.adaptors/range.concat/iterator/compare.pass.cpp

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88

99
// REQUIRES: std-at-least-c++26
1010

11+
// operator==(x,y)
12+
// operator==(x, sentinel)
13+
1114
#include <array>
1215
#include <cassert>
1316
#include <ranges>
@@ -59,9 +62,9 @@ constexpr void test() {
5962

6063
{
6164
// test with more than one view and iterators are in different range
62-
constexpr static std::array<int, 3> array1{0, 1, 2};
63-
constexpr static std::array<int, 3> array2{4, 5, 6};
64-
constexpr static std::ranges::concat_view view(std::views::all(array1), std::views::all(array2));
65+
std::array<int, 3> array1{0, 1, 2};
66+
std::array<int, 3> array2{4, 5, 6};
67+
std::ranges::concat_view view(std::views::all(array1), std::views::all(array2));
6568
decltype(auto) it1 = view.begin();
6669
decltype(auto) it2 = view.begin() + 3;
6770

@@ -79,10 +82,34 @@ constexpr void test() {
7982
ConcatView view = make_concat_view(array.data(), array.data() + array.size());
8083
assert(!(view.begin() == view.end()));
8184
}
85+
86+
{
87+
// operator==(x, sentinel)
88+
std::array<int, 2> array1{1, 2};
89+
std::array<int, 2> array2{3, 4};
90+
std::ranges::concat_view v(std::views::all(array1), std::views::all(array2));
91+
92+
auto it = v.begin();
93+
assert(!(it == std::default_sentinel_t{}));
94+
95+
it++;
96+
it++;
97+
it++;
98+
it++;
99+
assert(it == std::default_sentinel_t{});
100+
101+
// const-iterator
102+
const auto& cv = v;
103+
auto cit = cv.begin();
104+
++cit;
105+
++cit;
106+
++cit;
107+
++cit;
108+
assert(cit == std::default_sentinel_t{});
109+
}
82110
}
83111

84112
constexpr bool tests() {
85-
test<cpp17_input_iterator<int*>>();
86113
test<forward_iterator<int*>>();
87114
test<bidirectional_iterator<int*>>();
88115
test<random_access_iterator<int*>>();

0 commit comments

Comments
 (0)