[libcxx-commits] [libcxx] 6f0f2f9 - [libc++] Enable test for already written ranges algorithms
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Sun Jul 17 15:58:12 PDT 2022
Author: Nikolas Klauser
Date: 2022-07-18T00:58:07+02:00
New Revision: 6f0f2f9a1a514da3c8eee095632f7f8a3945e77f
URL: https://github.com/llvm/llvm-project/commit/6f0f2f9a1a514da3c8eee095632f7f8a3945e77f
DIFF: https://github.com/llvm/llvm-project/commit/6f0f2f9a1a514da3c8eee095632f7f8a3945e77f.diff
LOG: [libc++] Enable test for already written ranges algorithms
Reviewed By: Mordante, #libc
Spies: libcxx-commits
Differential Revision: https://reviews.llvm.org/D129970
Added:
Modified:
libcxx/test/libcxx/algorithms/ranges_robust_against_copying_projections.pass.cpp
libcxx/test/std/algorithms/ranges_robust_against_nonbool_predicates.compile.pass.cpp
libcxx/test/std/algorithms/ranges_robust_against_omitting_invoke.compile.pass.cpp
Removed:
################################################################################
diff --git a/libcxx/test/libcxx/algorithms/ranges_robust_against_copying_projections.pass.cpp b/libcxx/test/libcxx/algorithms/ranges_robust_against_copying_projections.pass.cpp
index f73ed50f12b57..b0740eaae2114 100644
--- a/libcxx/test/libcxx/algorithms/ranges_robust_against_copying_projections.pass.cpp
+++ b/libcxx/test/libcxx/algorithms/ranges_robust_against_copying_projections.pass.cpp
@@ -66,7 +66,7 @@ constexpr bool all_the_algorithms()
T *mid = a+5;
T *last = a+10;
T *first2 = b;
- //T *mid2 = b+5;
+ T *mid2 = b+5;
T *last2 = b+10;
void *value = nullptr;
int count = 1;
@@ -78,8 +78,8 @@ constexpr bool all_the_algorithms()
(void)std::ranges::all_of(a, UnaryTrue(), Proj(&copies)); assert(copies == 0);
(void)std::ranges::any_of(first, last, UnaryTrue(), Proj(&copies)); assert(copies == 0);
(void)std::ranges::any_of(a, UnaryTrue(), Proj(&copies)); assert(copies == 0);
- //(void)std::ranges::binary_search(first, last, value, Less(), Proj(&copies)); assert(copies == 0);
- //(void)std::ranges::binary_search(a, value, Less(), Proj(&copies)); assert(copies == 0);
+ (void)std::ranges::binary_search(first, last, value, Less(), Proj(&copies)); assert(copies == 0);
+ (void)std::ranges::binary_search(a, value, Less(), Proj(&copies)); assert(copies == 0);
//(void)std::ranges::clamp(T(), T(), T(), Less(), Proj(&copies)); assert(copies == 0);
(void)std::ranges::count(first, last, value, Proj(&copies)); assert(copies == 0);
(void)std::ranges::count(a, value, Proj(&copies)); assert(copies == 0);
@@ -96,8 +96,8 @@ constexpr bool all_the_algorithms()
//(void)std::ranges::equal_range(a, value, Less(), Proj(&copies)); assert(copies == 0);
(void)std::ranges::find(first, last, value, Proj(&copies)); assert(copies == 0);
(void)std::ranges::find(a, value, Proj(&copies)); assert(copies == 0);
- //(void)std::ranges::find_end(first, last, first2, mid2, Equal(), Proj(&copies), Proj(&copies)); assert(copies == 0);
- //(void)std::ranges::find_end(a, b, Equal(), Proj(&copies), Proj(&copies)); assert(copies == 0);
+ (void)std::ranges::find_end(first, last, first2, mid2, Equal(), Proj(&copies), Proj(&copies)); assert(copies == 0);
+ (void)std::ranges::find_end(a, b, Equal(), Proj(&copies), Proj(&copies)); assert(copies == 0);
(void)std::ranges::find_first_of(first, last, first2, last2, Equal(), Proj(&copies), Proj(&copies)); assert(copies == 0);
(void)std::ranges::find_first_of(a, b, Equal(), Proj(&copies), Proj(&copies)); assert(copies == 0);
(void)std::ranges::find_if(first, last, UnaryTrue(), Proj(&copies)); assert(copies == 0);
@@ -125,8 +125,8 @@ constexpr bool all_the_algorithms()
//if (!std::is_constant_evaluated()) { (void)std::ranges::inplace_merge(a, mid, Less(), Proj(&copies)); assert(copies == 0); }
(void)std::ranges::lexicographical_compare(first, last, first2, last2, Less(), Proj(&copies), Proj(&copies)); assert(copies == 0);
(void)std::ranges::lexicographical_compare(a, b, Less(), Proj(&copies), Proj(&copies)); assert(copies == 0);
- //(void)std::ranges::lower_bound(first, last, value, Less(), Proj(&copies)); assert(copies == 0);
- //(void)std::ranges::lower_bound(a, value, Less(), Proj(&copies)); assert(copies == 0);
+ (void)std::ranges::lower_bound(first, last, value, Less(), Proj(&copies)); assert(copies == 0);
+ (void)std::ranges::lower_bound(a, value, Less(), Proj(&copies)); assert(copies == 0);
(void)std::ranges::make_heap(first, last, Less(), Proj(&copies)); assert(copies == 0);
(void)std::ranges::make_heap(a, Less(), Proj(&copies)); assert(copies == 0);
(void)std::ranges::max(T(), T(), Less(), Proj(&copies)); assert(copies == 0);
@@ -186,10 +186,10 @@ constexpr bool all_the_algorithms()
(void)std::ranges::replace(a, value, T(), Proj(&copies)); assert(copies == 0);
(void)std::ranges::replace_if(first, last, UnaryTrue(), T(), Proj(&copies)); assert(copies == 0);
(void)std::ranges::replace_if(a, UnaryTrue(), T(), Proj(&copies)); assert(copies == 0);
- //(void)std::ranges::search(first, last, first2, mid2, Equal(), Proj(&copies), Proj(&copies)); assert(copies == 0);
- //(void)std::ranges::search(a, b, Equal(), Proj(&copies), Proj(&copies)); assert(copies == 0);
- //(void)std::ranges::search_n(first, last, count, value, Equal(), Proj(&copies)); assert(copies == 0);
- //(void)std::ranges::search_n(a, count, value, Equal(), Proj(&copies)); assert(copies == 0);
+ (void)std::ranges::search(first, last, first2, mid2, Equal(), Proj(&copies), Proj(&copies)); assert(copies == 0);
+ (void)std::ranges::search(a, b, Equal(), Proj(&copies), Proj(&copies)); assert(copies == 0);
+ (void)std::ranges::search_n(first, last, count, value, Equal(), Proj(&copies)); assert(copies == 0);
+ (void)std::ranges::search_n(a, count, value, Equal(), Proj(&copies)); assert(copies == 0);
(void)std::ranges::set_
diff erence(first, mid, mid, last, first2, Less(), Proj(&copies), Proj(&copies)); assert(copies == 0);
(void)std::ranges::set_
diff erence(a, b, first2, Less(), Proj(&copies), Proj(&copies)); assert(copies == 0);
(void)std::ranges::set_intersection(first, mid, mid, last, first2, Less(), Proj(&copies), Proj(&copies)); assert(copies == 0);
@@ -217,8 +217,8 @@ constexpr bool all_the_algorithms()
//(void)std::ranges::unique(a, Equal(), Proj(&copies)); assert(copies == 0);
//(void)std::ranges::unique_copy(first, last, first2, Equal(), Proj(&copies)); assert(copies == 0);
//(void)std::ranges::unique_copy(a, first2, Equal(), Proj(&copies)); assert(copies == 0);
- //(void)std::ranges::upper_bound(first, last, value, Less(), Proj(&copies)); assert(copies == 0);
- //(void)std::ranges::upper_bound(a, value, Less(), Proj(&copies)); assert(copies == 0);
+ (void)std::ranges::upper_bound(first, last, value, Less(), Proj(&copies)); assert(copies == 0);
+ (void)std::ranges::upper_bound(a, value, Less(), Proj(&copies)); assert(copies == 0);
return true;
}
diff --git a/libcxx/test/std/algorithms/ranges_robust_against_nonbool_predicates.compile.pass.cpp b/libcxx/test/std/algorithms/ranges_robust_against_nonbool_predicates.compile.pass.cpp
index 5aad3cffd16f2..cd8bde50b58ac 100644
--- a/libcxx/test/std/algorithms/ranges_robust_against_nonbool_predicates.compile.pass.cpp
+++ b/libcxx/test/std/algorithms/ranges_robust_against_nonbool_predicates.compile.pass.cpp
@@ -87,7 +87,7 @@ void test_all() {
//auto out2 = output.begin() + 1;
int x = 2;
- //int count = 1;
+ int count = 1;
in_pred(std::ranges::any_of, in, unary_pred);
in_pred(std::ranges::all_of, in, unary_pred);
@@ -123,9 +123,9 @@ void test_all() {
in_pred(std::ranges::minmax_element, in, binary_pred);
in_pred(std::ranges::count_if, in, unary_pred);
//in2_pred(std::ranges::search, in, in2, binary_pred);
- //std::ranges::search_n(in.begin(), in.end(), count, x, binary_pred);
- //std::ranges::search_n(in, count, x, binary_pred);
- //in2_pred(std::ranges::find_end, in, in2, binary_pred);
+ std::ranges::search_n(in.begin(), in.end(), count, x, binary_pred);
+ std::ranges::search_n(in, count, x, binary_pred);
+ in2_pred(std::ranges::find_end, in, in2, binary_pred);
in_pred(std::ranges::is_partitioned, in, unary_pred);
in_pred(std::ranges::is_sorted, in, binary_pred);
in_pred(std::ranges::is_sorted_until, in, binary_pred);
diff --git a/libcxx/test/std/algorithms/ranges_robust_against_omitting_invoke.compile.pass.cpp b/libcxx/test/std/algorithms/ranges_robust_against_omitting_invoke.compile.pass.cpp
index b951b5bc5127a..48b20348a295a 100644
--- a/libcxx/test/std/algorithms/ranges_robust_against_omitting_invoke.compile.pass.cpp
+++ b/libcxx/test/std/algorithms/ranges_robust_against_omitting_invoke.compile.pass.cpp
@@ -136,11 +136,11 @@ void test_all() {
in_pred(std::ranges::minmax_element, in, &Foo::binary_pred, &Bar::val);
in_val(std::ranges::count, in, x, &Bar::val);
in_pred(std::ranges::count_if, in, &Foo::unary_pred, &Bar::val);
- //in2_pred(std::ranges::search, in, in2, &Foo::binary_pred, &Bar::val, &Bar::val);
+ in2_pred(std::ranges::search, in, in2, &Foo::binary_pred, &Bar::val, &Bar::val);
// search_n
- //std::ranges::search_n(in.begin(), in.end(), count, x, &Foo::binary_pred, &Bar::val);
- //std::ranges::search_n(in, count, x, &Foo::binary_pred, &Bar::val);
- //in2_pred(std::ranges::find_end, in, in2, &Foo::binary_pred, &Bar::val, &Bar::val);
+ std::ranges::search_n(in.begin(), in.end(), count, x, &Foo::binary_pred, &Bar::val);
+ std::ranges::search_n(in, count, x, &Foo::binary_pred, &Bar::val);
+ in2_pred(std::ranges::find_end, in, in2, &Foo::binary_pred, &Bar::val, &Bar::val);
in_pred(std::ranges::is_partitioned, in, &Foo::unary_pred, &Bar::val);
in_pred(std::ranges::is_sorted, in, &Foo::binary_pred, &Bar::val);
in_pred(std::ranges::is_sorted_until, in, &Foo::binary_pred, &Bar::val);
More information about the libcxx-commits
mailing list