Skip to content

Commit 811695b

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

File tree

9 files changed

+13
-12
lines changed

9 files changed

+13
-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: 3 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
@@ -96,8 +96,8 @@ concept CanBePiped = requires(View&& view, T&& t) {
9696
{ std::forward<View>(view) | std::forward<T>(t) };
9797
};
9898

99-
template <class T, class U = T>
100-
concept weakly_equality_comparable_with = requires(const T& t, const U& u) {
99+
template <class T, class U>
100+
concept weakly_equality_comparable_with = requires(const std::remove_reference_t<T>& t, const std::remove_reference_t<U>& u) {
101101
{ t == u } -> std::same_as<bool>;
102102
{ t != u } -> std::same_as<bool>;
103103
{ 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
@@ -281,6 +281,7 @@ def getTestsForPath(self, testSuite, pathInSuite, litConfig, localConfig):
281281
for test in self._generateGenTest(testSuite, pathInSuite, litConfig, localConfig):
282282
yield test
283283
else:
284+
print(f"{localConfig.substitutions=}")
284285
yield lit.Test.Test(testSuite, pathInSuite, localConfig)
285286

286287
def execute(self, test, litConfig):

0 commit comments

Comments
 (0)