Skip to content

Commit ee61f15

Browse files
committed
fixup! [libc++][NFC] Centralize test for support of == and != in ranges
Address feedback.
1 parent d7485ce commit ee61f15

File tree

9 files changed

+14
-12
lines changed

9 files changed

+14
-12
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ constexpr bool test() {
140140
auto it = ev.begin();
141141

142142
using ElemIter = decltype(it);
143-
static_assert(!weakly_equality_comparable_with<ElemIter>);
143+
static_assert(!weakly_equality_comparable_with<ElemIter, ElemIter>);
144144
inequalityOperatorsDoNotExistTest(it, it);
145145
}
146146

libcxx/test/std/ranges/range.adaptors/range.elements/sentinel/equality.pass.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ static_assert(!weakly_equality_comparable_with<iterator_t<elements_view<R, 0>>,
8080
static_assert(weakly_equality_comparable_with<iterator_t<const elements_view<R, 0>>, //
8181
sentinel_t<const elements_view<R, 0>>>);
8282

83-
static_assert(weakly_equality_comparable_with<iterator_t<elements_view<R, 0>>, //
84-
sentinel_t<elements_view<R, 0>>>);
83+
static_assert(weakly_equality_comparable_with<iterator_t<elements_view<CrossComparableR, 0>>, //
84+
sentinel_t<elements_view<CrossComparableR, 0>>>);
8585

8686
static_assert(weakly_equality_comparable_with<iterator_t<const elements_view<CrossComparableR, 0>>, //
8787
sentinel_t<elements_view<CrossComparableR, 0>>>);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ constexpr bool tests() {
7676
using Sentinel = sentinel_wrapper<Iterator>;
7777
using FilterView = std::ranges::filter_view<minimal_view<Iterator, Sentinel>, AlwaysTrue>;
7878
using FilterIterator = std::ranges::iterator_t<FilterView>;
79-
static_assert(!weakly_equality_comparable_with<FilterIterator>);
79+
static_assert(!weakly_equality_comparable_with<FilterIterator, FilterIterator>);
8080
}
8181

8282
return true;

libcxx/test/std/ranges/range.adaptors/range.lazy.split/range.lazy.split.inner/equal.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ constexpr bool test() {
5353
auto b = val.begin();
5454
std::same_as<std::default_sentinel_t> decltype(auto) e = val.end();
5555

56-
static_assert(!weakly_equality_comparable_with<decltype(b)>);
56+
static_assert(!weakly_equality_comparable_with<decltype(b), decltype(b)>);
5757

5858
assert(!(b == std::default_sentinel));
5959
assert(b != std::default_sentinel);

libcxx/test/std/ranges/range.adaptors/range.lazy.split/range.lazy.split.outer/equal.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ constexpr bool test() {
6666
auto b = v.begin();
6767
std::same_as<std::default_sentinel_t> decltype(auto) e = v.end();
6868

69-
static_assert(!weakly_equality_comparable_with<decltype(b)>);
69+
static_assert(!weakly_equality_comparable_with<decltype(b), decltype(b)>);
7070

7171
assert(!(b == std::default_sentinel));
7272
assert(b != std::default_sentinel);

libcxx/test/std/ranges/range.adaptors/range.take.while/sentinel/equality.pass.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ static_assert(!weakly_equality_comparable_with<iterator_t<take_while_view<R, Les
8686
static_assert(weakly_equality_comparable_with<iterator_t<const take_while_view<R, LessThan3>>, //
8787
sentinel_t<const take_while_view<R, LessThan3>>>);
8888

89-
static_assert(weakly_equality_comparable_with<iterator_t<take_while_view<R, LessThan3>>, //
90-
sentinel_t<take_while_view<R, LessThan3>>>);
89+
static_assert(weakly_equality_comparable_with<iterator_t<take_while_view<CrossComparableR, LessThan3>>, //
90+
sentinel_t<take_while_view<CrossComparableR, LessThan3>>>);
9191

9292
static_assert(weakly_equality_comparable_with<iterator_t<const take_while_view<CrossComparableR, LessThan3>>, //
9393
sentinel_t<take_while_view<CrossComparableR, LessThan3>>>);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ constexpr bool test() {
242242
std::ranges::zip_view r(IterNoEqualView{buffer});
243243
auto it = r.begin();
244244
using Iter = decltype(it);
245-
static_assert(!weakly_equality_comparable_with<Iter>);
245+
static_assert(!weakly_equality_comparable_with<Iter, Iter>);
246246
inequalityOperatorsDoNotExistTest(it, it);
247247
}
248248
return true;

libcxx/test/support/test_range.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
#include <functional>
1414
#include <iterator>
1515
#include <ranges>
16+
#include <type_traits>
1617

17-
#include "__concepts/invocable.h"
1818
#include "test_iterators.h"
1919

2020
#if TEST_STD_VER < 17
@@ -91,8 +91,9 @@ concept simple_view =
9191
std::same_as<std::ranges::iterator_t<Range>, std::ranges::iterator_t<const Range>> &&
9292
std::same_as<std::ranges::sentinel_t<Range>, std::ranges::sentinel_t<const Range>>;
9393

94-
template <class T, class U = T>
95-
concept weakly_equality_comparable_with = requires(const T& t, const U& u) {
94+
// See [concept.equalitycomparable]
95+
template <class T, class U>
96+
concept weakly_equality_comparable_with = requires(const std::remove_reference_t<T>& t, const std::remove_reference_t<U>& u) {
9697
{ t == u } -> std::same_as<bool>;
9798
{ t != u } -> std::same_as<bool>;
9899
{ u == t } -> std::same_as<bool>;

libcxx/utils/libcxx/test/format.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ def getTestsForPath(self, testSuite, pathInSuite, litConfig, localConfig):
282282
for test in self._generateGenTest(testSuite, pathInSuite, litConfig, localConfig):
283283
yield test
284284
else:
285+
print(f"{localConfig.substitutions=}")
285286
yield lit.Test.Test(testSuite, pathInSuite, localConfig)
286287

287288
def execute(self, test, litConfig):

0 commit comments

Comments
 (0)