forked from OSchip/llvm-project
[libc++] Enable ranges_robust_against* and niebloid tests for implemented ranges algorithms
Spies: libcxx-commits Differential Revision: https://reviews.llvm.org/D126477
This commit is contained in:
parent
aaaf9cede7
commit
3606da5fba
|
@ -8,7 +8,7 @@ Search,find_if_not,Nikolas Klauser,`D121248 <https://reviews.llvm.org/D121248>`_
|
|||
Search,find_first_of,Not assigned,n/a,Not started
|
||||
Search,adjacent_find,Not assigned,n/a,Not started
|
||||
Search,mismatch,Nikolas Klauser,`D117817 <https://llvm.org/D117817>`_,✅
|
||||
Search,equal,Nikolas Klauser,n/a,✅
|
||||
Search,equal,Nikolas Klauser,`D123681 <https://reviews.llvm.org/D123681>`,✅
|
||||
Search,lexicographical_compare,Not assigned,n/a,Not started
|
||||
Search,partition_point,Christopher Di Bella,`D105794 <https://llvm.org/D105794>`_,Under review
|
||||
Search,lower_bound,Christopher Di Bella,`D105795 <https://llvm.org/D105795>`_,Under review
|
||||
|
@ -34,8 +34,8 @@ Read-only,is_heap,Not assigned,n/a,Not started
|
|||
Read-only,is_heap_until,Not assigned,n/a,Not started
|
||||
Read-only,clamp,Not assigned,n/a,Not started
|
||||
Read-only,is_permutation,Not assigned,n/a,Not started
|
||||
Read-only,for_each,Nikolas Klauser,n/a,✅
|
||||
Read-only,for_each_n,Nikolas Klauser,n/a,✅
|
||||
Read-only,for_each,Nikolas Klauser,`D124332 <https://llvm.org/D124332>`_,✅
|
||||
Read-only,for_each_n,Nikolas Klauser,`D124332 <https://llvm.org/D124332>`_,✅
|
||||
Write,copy,Nikolas Klauser,`D122982 <https://llvm.org/D122982>`_,✅
|
||||
Write,copy_if,Nikolas Klauser,`D122982 <https://llvm.org/D122982>`_,✅
|
||||
Write,copy_n,Nikolas Klauser,`D122982 <https://llvm.org/D122982>`_,✅
|
||||
|
|
|
|
@ -81,13 +81,13 @@ constexpr bool all_the_algorithms()
|
|||
void *b[10] = {};
|
||||
//void *half[5] = {};
|
||||
void **first = a;
|
||||
//void **mid = a+5;
|
||||
void **mid = a+5;
|
||||
void **last = a+10;
|
||||
void **first2 = b;
|
||||
//void **mid2 = b+5;
|
||||
void **last2 = b+10;
|
||||
void *value = nullptr;
|
||||
//int count = 1;
|
||||
int count = 1;
|
||||
|
||||
int copies = 0;
|
||||
//(void)std::ranges::adjacent_find(first, last, Equal(&copies)); assert(copies == 0);
|
||||
|
@ -101,8 +101,8 @@ constexpr bool all_the_algorithms()
|
|||
//(void)std::ranges::clamp(value, value, value, Less(&copies)); assert(copies == 0);
|
||||
(void)std::ranges::count_if(first, last, UnaryTrue(&copies)); assert(copies == 0);
|
||||
(void)std::ranges::count_if(a, UnaryTrue(&copies)); assert(copies == 0);
|
||||
//(void)std::ranges::copy_if(first, last, first2, UnaryTrue(&copies)); assert(copies == 0);
|
||||
//(void)std::ranges::copy_if(a, first2, UnaryTrue(&copies)); assert(copies == 0);
|
||||
(void)std::ranges::copy_if(first, last, first2, UnaryTrue(&copies)); assert(copies == 0);
|
||||
(void)std::ranges::copy_if(a, first2, UnaryTrue(&copies)); assert(copies == 0);
|
||||
#if TEST_STD_VER > 20
|
||||
//(void)std::ranges::ends_with(first, last, first2, last2, Equal(&copies)); assert(copies == 0);
|
||||
#endif
|
||||
|
@ -118,9 +118,9 @@ constexpr bool all_the_algorithms()
|
|||
(void)std::ranges::find_if(a, UnaryTrue(&copies)); assert(copies == 0);
|
||||
(void)std::ranges::find_if_not(first, last, UnaryTrue(&copies)); assert(copies == 0);
|
||||
(void)std::ranges::find_if_not(a, UnaryTrue(&copies)); assert(copies == 0);
|
||||
//(void)std::ranges::for_each(first, last, UnaryVoid(&copies)); assert(copies == 1); copies = 0;
|
||||
//(void)std::ranges::for_each(a, UnaryVoid(&copies)); assert(copies == 1); copies = 0;
|
||||
//(void)std::ranges::for_each_n(first, count, UnaryVoid(&copies)); assert(copies == 0);
|
||||
(void)std::ranges::for_each(first, last, UnaryVoid(&copies)); assert(copies == 1); copies = 0;
|
||||
(void)std::ranges::for_each(a, UnaryVoid(&copies)); assert(copies == 1); copies = 0;
|
||||
(void)std::ranges::for_each_n(first, count, UnaryVoid(&copies)); assert(copies == 1); copies = 0;
|
||||
//(void)std::ranges::generate(first, last, NullaryValue(&copies)); assert(copies == 0);
|
||||
//(void)std::ranges::generate(a, NullaryValue(&copies)); assert(copies == 0);
|
||||
//(void)std::ranges::generate_n(first, count, NullaryValue(&copies)); assert(copies == 0);
|
||||
|
@ -130,8 +130,8 @@ constexpr bool all_the_algorithms()
|
|||
//(void)std::ranges::is_heap(a, Less(&copies)); assert(copies == 0);
|
||||
//(void)std::ranges::is_heap_until(first, last, Less(&copies)); assert(copies == 0);
|
||||
//(void)std::ranges::is_heap_until(a, Less(&copies)); assert(copies == 0);
|
||||
//(void)std::ranges::is_partitioned(first, last, UnaryTrue(&copies)); assert(copies == 0);
|
||||
//(void)std::ranges::is_partitioned(a, UnaryTrue(&copies)); assert(copies == 0);
|
||||
(void)std::ranges::is_partitioned(first, last, UnaryTrue(&copies)); assert(copies == 0);
|
||||
(void)std::ranges::is_partitioned(a, UnaryTrue(&copies)); assert(copies == 0);
|
||||
//(void)std::ranges::is_permutation(first, last, first2, last2, Equal(&copies)); assert(copies == 0);
|
||||
//(void)std::ranges::is_permutation(a, b, Equal(&copies)); assert(copies == 0);
|
||||
(void)std::ranges::is_sorted(first, last, Less(&copies)); assert(copies == 0);
|
||||
|
@ -146,16 +146,16 @@ constexpr bool all_the_algorithms()
|
|||
//(void)std::ranges::lower_bound(a, value, Less(&copies)); assert(copies == 0);
|
||||
//(void)std::ranges::make_heap(first, last, Less(&copies)); assert(copies == 0);
|
||||
//(void)std::ranges::make_heap(a, Less(&copies)); assert(copies == 0);
|
||||
//(void)std::ranges::max(value, value, Less(&copies)); assert(copies == 0);
|
||||
//(void)std::ranges::max({ value, value }, Less(&copies)); assert(copies == 0);
|
||||
//(void)std::ranges::max(a, Less(&copies)); assert(copies == 0);
|
||||
(void)std::ranges::max(value, value, Less(&copies)); assert(copies == 0);
|
||||
(void)std::ranges::max({ value, value }, Less(&copies)); assert(copies == 0);
|
||||
(void)std::ranges::max(a, Less(&copies)); assert(copies == 0);
|
||||
(void)std::ranges::max_element(first, last, Less(&copies)); assert(copies == 0);
|
||||
(void)std::ranges::max_element(a, Less(&copies)); assert(copies == 0);
|
||||
//(void)std::ranges::merge(first, mid, mid, last, first2, Less(&copies)); assert(copies == 0);
|
||||
//(void)std::ranges::merge(half, half, b, Less(&copies)); assert(copies == 0);
|
||||
//(void)std::ranges::min(value, value, Less(&copies)); assert(copies == 0);
|
||||
//(void)std::ranges::min({ value, value }, Less(&copies)); assert(copies == 0);
|
||||
//(void)std::ranges::min(a, Less(&copies)); assert(copies == 0);
|
||||
(void)std::ranges::min(value, value, Less(&copies)); assert(copies == 0);
|
||||
(void)std::ranges::min({ value, value }, Less(&copies)); assert(copies == 0);
|
||||
(void)std::ranges::min(a, Less(&copies)); assert(copies == 0);
|
||||
(void)std::ranges::min_element(first, last, Less(&copies)); assert(copies == 0);
|
||||
(void)std::ranges::min_element(a, Less(&copies)); assert(copies == 0);
|
||||
(void)std::ranges::minmax(value, value, Less(&copies)); assert(copies == 0);
|
||||
|
@ -218,10 +218,10 @@ constexpr bool all_the_algorithms()
|
|||
#if TEST_STD_VER > 20
|
||||
//(void)std::ranges::starts_with(first, last, first2, last2, Equal(&copies)); assert(copies == 0);
|
||||
#endif
|
||||
//(void)std::ranges::transform(first, last, first2, UnaryTransform(&copies)); assert(copies == 0);
|
||||
//(void)std::ranges::transform(a, first2, UnaryTransform(&copies)); assert(copies == 0);
|
||||
//(void)std::ranges::transform(first, mid, mid, last, first2, BinaryTransform(&copies)); assert(copies == 0);
|
||||
//(void)std::ranges::transform(a, b, first2, BinaryTransform(&copies)); assert(copies == 0);
|
||||
(void)std::ranges::transform(first, last, first2, UnaryTransform(&copies)); assert(copies == 0);
|
||||
(void)std::ranges::transform(a, first2, UnaryTransform(&copies)); assert(copies == 0);
|
||||
(void)std::ranges::transform(first, mid, mid, last, first2, BinaryTransform(&copies)); assert(copies == 0);
|
||||
(void)std::ranges::transform(a, b, first2, BinaryTransform(&copies)); assert(copies == 0);
|
||||
//(void)std::ranges::unique(first, last, Equal(&copies)); assert(copies == 0);
|
||||
//(void)std::ranges::unique(a, Equal(&copies)); assert(copies == 0);
|
||||
//(void)std::ranges::unique_copy(first, last, first2, Equal(&copies)); assert(copies == 0);
|
||||
|
|
|
@ -63,13 +63,13 @@ constexpr bool all_the_algorithms()
|
|||
T b[10] = {};
|
||||
//T half[5] = {};
|
||||
T *first = a;
|
||||
//T *mid = a+5;
|
||||
T *mid = a+5;
|
||||
T *last = a+10;
|
||||
T *first2 = b;
|
||||
//T *mid2 = b+5;
|
||||
T *last2 = b+10;
|
||||
void *value = nullptr;
|
||||
//int count = 1;
|
||||
int count = 1;
|
||||
|
||||
int copies = 0;
|
||||
//(void)std::ranges::adjacent_find(first, last, Equal(), Proj(&copies)); assert(copies == 0);
|
||||
|
@ -85,8 +85,8 @@ constexpr bool all_the_algorithms()
|
|||
(void)std::ranges::count(a, value, Proj(&copies)); assert(copies == 0);
|
||||
(void)std::ranges::count_if(first, last, UnaryTrue(), Proj(&copies)); assert(copies == 0);
|
||||
(void)std::ranges::count_if(a, UnaryTrue(), Proj(&copies)); assert(copies == 0);
|
||||
//(void)std::ranges::copy_if(first, last, first2, UnaryTrue(), Proj(&copies)); assert(copies == 0);
|
||||
//(void)std::ranges::copy_if(a, first2, UnaryTrue(), Proj(&copies)); assert(copies == 0);
|
||||
(void)std::ranges::copy_if(first, last, first2, UnaryTrue(), Proj(&copies)); assert(copies == 0);
|
||||
(void)std::ranges::copy_if(a, first2, UnaryTrue(), Proj(&copies)); assert(copies == 0);
|
||||
#if TEST_STD_VER > 20
|
||||
//(void)std::ranges::ends_with(first, last, first2, last2, Equal(), Proj(&copies), Proj(&copies)); assert(copies == 0);
|
||||
#endif
|
||||
|
@ -104,17 +104,17 @@ constexpr bool all_the_algorithms()
|
|||
(void)std::ranges::find_if(a, UnaryTrue(), Proj(&copies)); assert(copies == 0);
|
||||
(void)std::ranges::find_if_not(first, last, UnaryTrue(), Proj(&copies)); assert(copies == 0);
|
||||
(void)std::ranges::find_if_not(a, UnaryTrue(), Proj(&copies)); assert(copies == 0);
|
||||
//(void)std::ranges::for_each(first, last, UnaryVoid(), Proj(&copies)); assert(copies == 1); copies = 0;
|
||||
//(void)std::ranges::for_each(a, UnaryVoid(), Proj(&copies)); assert(copies == 1); copies = 0;
|
||||
//(void)std::ranges::for_each_n(first, count, UnaryVoid(), Proj(&copies)); assert(copies == 0);
|
||||
(void)std::ranges::for_each(first, last, UnaryVoid(), Proj(&copies)); assert(copies == 0);
|
||||
(void)std::ranges::for_each(a, UnaryVoid(), Proj(&copies)); assert(copies == 0);
|
||||
(void)std::ranges::for_each_n(first, count, UnaryVoid(), Proj(&copies)); assert(copies == 0);
|
||||
//(void)std::ranges::includes(first, last, first2, last2, Less(), Proj(&copies), Proj(&copies)); assert(copies == 0);
|
||||
//(void)std::ranges::includes(a, b, Less(), Proj(&copies), Proj(&copies)); assert(copies == 0);
|
||||
//(void)std::ranges::is_heap(first, last, Less(), Proj(&copies)); assert(copies == 0);
|
||||
//(void)std::ranges::is_heap(a, Less(), Proj(&copies)); assert(copies == 0);
|
||||
//(void)std::ranges::is_heap_until(first, last, Less(), Proj(&copies)); assert(copies == 0);
|
||||
//(void)std::ranges::is_heap_until(a, Less(), Proj(&copies)); assert(copies == 0);
|
||||
//(void)std::ranges::is_partitioned(first, last, UnaryTrue(), Proj(&copies)); assert(copies == 0);
|
||||
//(void)std::ranges::is_partitioned(a, UnaryTrue(), Proj(&copies)); assert(copies == 0);
|
||||
(void)std::ranges::is_partitioned(first, last, UnaryTrue(), Proj(&copies)); assert(copies == 0);
|
||||
(void)std::ranges::is_partitioned(a, UnaryTrue(), Proj(&copies)); assert(copies == 0);
|
||||
//(void)std::ranges::is_permutation(first, last, first2, last2, Equal(), Proj(&copies), Proj(&copies)); assert(copies == 0);
|
||||
//(void)std::ranges::is_permutation(a, b, Equal(), Proj(&copies), Proj(&copies)); assert(copies == 0);
|
||||
(void)std::ranges::is_sorted(first, last, Less(), Proj(&copies)); assert(copies == 0);
|
||||
|
@ -129,16 +129,16 @@ constexpr bool all_the_algorithms()
|
|||
//(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);
|
||||
//(void)std::ranges::max({ T(), T() }, Less(), Proj(&copies)); assert(copies == 0);
|
||||
//(void)std::ranges::max(a, Less(), Proj(&copies)); assert(copies == 0);
|
||||
(void)std::ranges::max(T(), T(), Less(), Proj(&copies)); assert(copies == 0);
|
||||
(void)std::ranges::max({ T(), T() }, Less(), Proj(&copies)); assert(copies == 0);
|
||||
(void)std::ranges::max(a, Less(), Proj(&copies)); assert(copies == 0);
|
||||
(void)std::ranges::max_element(first, last, Less(), Proj(&copies)); assert(copies == 0);
|
||||
(void)std::ranges::max_element(a, Less(), Proj(&copies)); assert(copies == 0);
|
||||
//(void)std::ranges::merge(first, mid, mid, last, first2, Less(), Proj(&copies), Proj(&copies)); assert(copies == 0);
|
||||
//(void)std::ranges::merge(half, half, b, Less(), Proj(&copies), Proj(&copies)); assert(copies == 0);
|
||||
//(void)std::ranges::min(T(), T(), Less(), Proj(&copies)); assert(copies == 0);
|
||||
//(void)std::ranges::min({ T(), T() }, Less(), Proj(&copies)); assert(copies == 0);
|
||||
//(void)std::ranges::min(a, Less(), Proj(&copies)); assert(copies == 0);
|
||||
(void)std::ranges::min(T(), T(), Less(), Proj(&copies)); assert(copies == 0);
|
||||
(void)std::ranges::min({ T(), T() }, Less(), Proj(&copies)); assert(copies == 0);
|
||||
(void)std::ranges::min(a, Less(), Proj(&copies)); assert(copies == 0);
|
||||
(void)std::ranges::min_element(first, last, Less(), Proj(&copies)); assert(copies == 0);
|
||||
(void)std::ranges::min_element(a, Less(), Proj(&copies)); assert(copies == 0);
|
||||
(void)std::ranges::minmax(T(), T(), Less(), Proj(&copies)); assert(copies == 0);
|
||||
|
@ -209,10 +209,10 @@ constexpr bool all_the_algorithms()
|
|||
#if TEST_STD_VER > 20
|
||||
//(void)std::ranges::starts_with(first, last, first2, last2, Equal(), Proj(&copies), Proj(&copies)); assert(copies == 0);
|
||||
#endif
|
||||
//(void)std::ranges::transform(first, last, first2, UnaryTransform(), Proj(&copies)); assert(copies == 0);
|
||||
//(void)std::ranges::transform(a, first2, UnaryTransform(), Proj(&copies)); assert(copies == 0);
|
||||
//(void)std::ranges::transform(first, mid, mid, last, first2, BinaryTransform(), Proj(&copies), Proj(&copies)); assert(copies == 0);
|
||||
//(void)std::ranges::transform(a, b, first2, BinaryTransform(), Proj(&copies), Proj(&copies)); assert(copies == 0);
|
||||
(void)std::ranges::transform(first, last, first2, UnaryTransform(), Proj(&copies)); assert(copies == 0);
|
||||
(void)std::ranges::transform(a, first2, UnaryTransform(), Proj(&copies)); assert(copies == 0);
|
||||
(void)std::ranges::transform(first, mid, mid, last, first2, BinaryTransform(), Proj(&copies), Proj(&copies)); assert(copies == 0);
|
||||
(void)std::ranges::transform(a, b, first2, BinaryTransform(), Proj(&copies), Proj(&copies)); assert(copies == 0);
|
||||
//(void)std::ranges::unique(first, last, Equal(), Proj(&copies)); assert(copies == 0);
|
||||
//(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);
|
||||
|
|
|
@ -54,7 +54,7 @@ constexpr bool test(CPO& o, Args&&...) {
|
|||
int *p;
|
||||
int a[10];
|
||||
auto odd = [](int x) { return x % 2 != 0; };
|
||||
//auto triple = [](int x) { return 3*x; };
|
||||
auto triple = [](int x) { return 3*x; };
|
||||
//auto plus = [](int x, int y) { return x == y; };
|
||||
//std::mt19937 g;
|
||||
|
||||
|
@ -65,38 +65,38 @@ static_assert(test(std::ranges::all_of, a, odd));
|
|||
static_assert(test(std::ranges::any_of, a, odd));
|
||||
//static_assert(test(std::ranges::binary_search, a, 42));
|
||||
//static_assert(test(std::ranges::clamp, 42, 42, 42));
|
||||
//static_assert(test(std::ranges::copy, a, a));
|
||||
//static_assert(test(std::ranges::copy_backward, a, a));
|
||||
//static_assert(test(std::ranges::copy_if, a, a, odd));
|
||||
//static_assert(test(std::ranges::copy_n, a, 10, a));
|
||||
static_assert(test(std::ranges::copy, a, a));
|
||||
static_assert(test(std::ranges::copy_backward, a, a));
|
||||
static_assert(test(std::ranges::copy_if, a, a, odd));
|
||||
static_assert(test(std::ranges::copy_n, a, 10, a));
|
||||
static_assert(test(std::ranges::count, a, 42));
|
||||
static_assert(test(std::ranges::count_if, a, odd));
|
||||
//static_assert(test(std::ranges::ends_with, a, a));
|
||||
//static_assert(test(std::ranges::equal, a, a));
|
||||
static_assert(test(std::ranges::equal, a, a));
|
||||
//static_assert(test(std::ranges::equal_range, a, 42));
|
||||
//static_assert(test(std::ranges::fill, a, 42));
|
||||
//static_assert(test(std::ranges::fill_n, a, 10, 42));
|
||||
static_assert(test(std::ranges::fill, a, 42));
|
||||
static_assert(test(std::ranges::fill_n, a, 10, 42));
|
||||
static_assert(test(std::ranges::find, a, 42));
|
||||
//static_assert(test(std::ranges::find_end, a, a));
|
||||
//static_assert(test(std::ranges::find_first_of, a, a));
|
||||
static_assert(test(std::ranges::find_if, a, odd));
|
||||
static_assert(test(std::ranges::find_if_not, a, odd));
|
||||
//static_assert(test(std::ranges::for_each, a, odd));
|
||||
//static_assert(test(std::ranges::for_each_n, a, 10, odd));
|
||||
static_assert(test(std::ranges::for_each, a, odd));
|
||||
static_assert(test(std::ranges::for_each_n, a, 10, odd));
|
||||
//static_assert(test(std::ranges::generate, a, 42));
|
||||
//static_assert(test(std::ranges::generate_n, a, 10, 42));
|
||||
//static_assert(test(std::ranges::includes, a, a));
|
||||
//static_assert(test(std::ranges::inplace_merge, a, a+5));
|
||||
//static_assert(test(std::ranges::is_heap, a));
|
||||
//static_assert(test(std::ranges::is_heap_until, a));
|
||||
//static_assert(test(std::ranges::is_partitioned, a, odd));
|
||||
static_assert(test(std::ranges::is_partitioned, a, odd));
|
||||
//static_assert(test(std::ranges::is_permutation, a, a));
|
||||
static_assert(test(std::ranges::is_sorted, a));
|
||||
static_assert(test(std::ranges::is_sorted_until, a));
|
||||
//static_assert(test(std::ranges::lexicographical_compare, a, a));
|
||||
//static_assert(test(std::ranges::lower_bound, a, 42));
|
||||
//static_assert(test(std::ranges::make_heap, a));
|
||||
//static_assert(test(std::ranges::max, a));
|
||||
static_assert(test(std::ranges::max, a));
|
||||
static_assert(test(std::ranges::max_element, a));
|
||||
//static_assert(test(std::ranges::merge, a, a, a));
|
||||
static_assert(test(std::ranges::min, a));
|
||||
|
@ -143,7 +143,7 @@ static_assert(test(std::ranges::reverse, a));
|
|||
//static_assert(test(std::ranges::stable_sort, a));
|
||||
//static_assert(test(std::ranges::starts_with, a, a));
|
||||
static_assert(test(std::ranges::swap_ranges, a, a));
|
||||
//static_assert(test(std::ranges::transform, a, a, triple));
|
||||
static_assert(test(std::ranges::transform, a, a, triple));
|
||||
//static_assert(test(std::ranges::unique, a));
|
||||
//static_assert(test(std::ranges::unique_copy, a, a));
|
||||
//static_assert(test(std::ranges::upper_bound, a, 42));
|
||||
|
|
Loading…
Reference in New Issue