diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2016-07-23 20:47:26 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2016-07-23 20:47:26 +0000 |
commit | 51072bd6bf79ef2bc6a922079bff57c31c1effbc (patch) | |
tree | 91a2effbc9e6f80bdbbf9eb70e06c51ad0867ea0 /test/std/algorithms | |
parent | bb5e33f003797b67974a8893f7f2930fc51b8210 (diff) |
Notes
Diffstat (limited to 'test/std/algorithms')
20 files changed, 295 insertions, 53 deletions
diff --git a/test/std/algorithms/alg.modifying.operations/alg.fill/fill_n.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.fill/fill_n.pass.cpp index 6617cd0916f3..b56d31b9d0db 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.fill/fill_n.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.fill/fill_n.pass.cpp @@ -62,7 +62,7 @@ test_int_array() struct source { source() : i(0) { } - + operator int() const { return i++; } mutable int i; }; diff --git a/test/std/algorithms/alg.nonmodifying/alg.equal/equal.pass.cpp b/test/std/algorithms/alg.nonmodifying/alg.equal/equal.pass.cpp index 234879149ae3..449753fc263a 100644 --- a/test/std/algorithms/alg.nonmodifying/alg.equal/equal.pass.cpp +++ b/test/std/algorithms/alg.nonmodifying/alg.equal/equal.pass.cpp @@ -61,6 +61,6 @@ int main() random_access_iterator<const int*>(ia+s), random_access_iterator<const int*>(ia), random_access_iterator<const int*>(ia+s-1))); - + #endif } diff --git a/test/std/algorithms/alg.nonmodifying/mismatch/mismatch_pred.pass.cpp b/test/std/algorithms/alg.nonmodifying/mismatch/mismatch_pred.pass.cpp index 3e1dfd17c3ff..054bc656cdb1 100644 --- a/test/std/algorithms/alg.nonmodifying/mismatch/mismatch_pred.pass.cpp +++ b/test/std/algorithms/alg.nonmodifying/mismatch/mismatch_pred.pass.cpp @@ -33,7 +33,7 @@ int main() const unsigned sa = sizeof(ia)/sizeof(ia[0]); int ib[] = {0, 1, 2, 3, 0, 1, 2, 3}; const unsigned sb = sizeof(ib)/sizeof(ib[0]); ((void)sb); // unused in c++11 - + typedef input_iterator<const int*> II; typedef random_access_iterator<const int*> RAI; typedef std::equal_to<int> EQ; @@ -48,7 +48,7 @@ int main() == (std::pair<RAI, RAI>(RAI(ia+3), RAI(ib+3)))); assert(bcp.count() > 0 && bcp.count() < sa); bcp.reset(); - + #ifdef HAS_FOUR_ITERATOR_VERSION assert(std::mismatch(II(ia), II(ia + sa), II(ib), II(ib + sb), EQ()) == (std::pair<II, II>(II(ia+3), II(ib+3)))); diff --git a/test/std/algorithms/alg.sorting/alg.clamp/clamp.comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.clamp/clamp.comp.pass.cpp new file mode 100644 index 000000000000..3fec12b6b53d --- /dev/null +++ b/test/std/algorithms/alg.sorting/alg.clamp/clamp.comp.pass.cpp @@ -0,0 +1,127 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <algorithm> +// XFAIL: c++98, c++03, c++11, c++14 + +// template<class T, class Compare> +// const T& +// clamp(const T& v, const T& lo, const T& hi, Compare comp); + +#include <algorithm> +#include <functional> +#include <cassert> + +struct Tag { + Tag() : val(0), tag("Default") {} + Tag(int a, const char *b) : val(a), tag(b) {} + ~Tag() {} + + int val; + const char *tag; + }; + +bool eq(const Tag& rhs, const Tag& lhs) { return rhs.val == lhs.val && rhs.tag == lhs.tag; } +// bool operator==(const Tag& rhs, const Tag& lhs) { return rhs.val == lhs.val; } +bool comp (const Tag& rhs, const Tag& lhs) { return rhs.val < lhs.val; } + + +template <class T, class C> +void +test(const T& v, const T& lo, const T& hi, C c, const T& x) +{ + assert(&std::clamp(v, lo, hi, c) == &x); +} + +int main() +{ + { + int x = 0; + int y = 0; + int z = 0; + test(x, y, z, std::greater<int>(), x); + test(y, x, z, std::greater<int>(), y); + } + { + int x = 0; + int y = 1; + int z = -1; + test(x, y, z, std::greater<int>(), x); + test(y, x, z, std::greater<int>(), x); + } + { + int x = 1; + int y = 0; + int z = 0; + test(x, y, z, std::greater<int>(), y); + test(y, x, z, std::greater<int>(), y); + } + + { +// If they're all the same, we should get the value back. + Tag x{0, "Zero-x"}; + Tag y{0, "Zero-y"}; + Tag z{0, "Zero-z"}; + assert(eq(std::clamp(x, y, z, comp), x)); + assert(eq(std::clamp(y, x, z, comp), y)); + } + + { +// If it's the same as the lower bound, we get the value back. + Tag x{0, "Zero-x"}; + Tag y{0, "Zero-y"}; + Tag z{1, "One-z"}; + assert(eq(std::clamp(x, y, z, comp), x)); + assert(eq(std::clamp(y, x, z, comp), y)); + } + + { +// If it's the same as the upper bound, we get the value back. + Tag x{1, "One-x"}; + Tag y{0, "Zero-y"}; + Tag z{1, "One-z"}; + assert(eq(std::clamp(x, y, z, comp), x)); + assert(eq(std::clamp(z, y, x, comp), z)); + } + + { +// If the value is between, we should get the value back + Tag x{1, "One-x"}; + Tag y{0, "Zero-y"}; + Tag z{2, "Two-z"}; + assert(eq(std::clamp(x, y, z, comp), x)); + assert(eq(std::clamp(y, x, z, comp), x)); + } + + { +// If the value is less than the 'lo', we should get the lo back. + Tag x{0, "Zero-x"}; + Tag y{1, "One-y"}; + Tag z{2, "Two-z"}; + assert(eq(std::clamp(x, y, z, comp), y)); + assert(eq(std::clamp(y, x, z, comp), y)); + } + { +// If the value is greater than 'hi', we should get hi back. + Tag x{2, "Two-x"}; + Tag y{0, "Zero-y"}; + Tag z{1, "One-z"}; + assert(eq(std::clamp(x, y, z, comp), z)); + assert(eq(std::clamp(y, z, x, comp), z)); + } + + { + typedef int T; + constexpr T x = 1; + constexpr T y = 0; + constexpr T z = 0; + static_assert(std::clamp(x, y, z, std::greater<T>()) == y, "" ); + static_assert(std::clamp(y, x, z, std::greater<T>()) == y, "" ); + } +} diff --git a/test/std/algorithms/alg.sorting/alg.clamp/clamp.pass.cpp b/test/std/algorithms/alg.sorting/alg.clamp/clamp.pass.cpp new file mode 100644 index 000000000000..779c41827c92 --- /dev/null +++ b/test/std/algorithms/alg.sorting/alg.clamp/clamp.pass.cpp @@ -0,0 +1,125 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <algorithm> +// XFAIL: c++98, c++03, c++11, c++14 + +// template<class T> +// const T& +// clamp(const T& v, const T& lo, const T& hi); + +#include <algorithm> +#include <cassert> + +struct Tag { + Tag() : val(0), tag("Default") {} + Tag(int a, const char *b) : val(a), tag(b) {} + ~Tag() {} + + int val; + const char *tag; + }; + +bool eq(const Tag& rhs, const Tag& lhs) { return rhs.val == lhs.val && rhs.tag == lhs.tag; } +// bool operator==(const Tag& rhs, const Tag& lhs) { return rhs.val == lhs.val; } +bool operator< (const Tag& rhs, const Tag& lhs) { return rhs.val < lhs.val; } + +template <class T> +void +test(const T& a, const T& lo, const T& hi, const T& x) +{ + assert(&std::clamp(a, lo, hi) == &x); +} + +int main() +{ + { + int x = 0; + int y = 0; + int z = 0; + test(x, y, z, x); + test(y, x, z, y); + } + { + int x = 0; + int y = 1; + int z = 2; + test(x, y, z, y); + test(y, x, z, y); + } + { + int x = 1; + int y = 0; + int z = 1; + test(x, y, z, x); + test(y, x, z, x); + } + + { +// If they're all the same, we should get the value back. + Tag x{0, "Zero-x"}; + Tag y{0, "Zero-y"}; + Tag z{0, "Zero-z"}; + assert(eq(std::clamp(x, y, z), x)); + assert(eq(std::clamp(y, x, z), y)); + } + + { +// If it's the same as the lower bound, we get the value back. + Tag x{0, "Zero-x"}; + Tag y{0, "Zero-y"}; + Tag z{1, "One-z"}; + assert(eq(std::clamp(x, y, z), x)); + assert(eq(std::clamp(y, x, z), y)); + } + + { +// If it's the same as the upper bound, we get the value back. + Tag x{1, "One-x"}; + Tag y{0, "Zero-y"}; + Tag z{1, "One-z"}; + assert(eq(std::clamp(x, y, z), x)); + assert(eq(std::clamp(z, y, x), z)); + } + + { +// If the value is between, we should get the value back + Tag x{1, "One-x"}; + Tag y{0, "Zero-y"}; + Tag z{2, "Two-z"}; + assert(eq(std::clamp(x, y, z), x)); + assert(eq(std::clamp(y, x, z), x)); + } + + { +// If the value is less than the 'lo', we should get the lo back. + Tag x{0, "Zero-x"}; + Tag y{1, "One-y"}; + Tag z{2, "Two-z"}; + assert(eq(std::clamp(x, y, z), y)); + assert(eq(std::clamp(y, x, z), y)); + } + { +// If the value is greater than 'hi', we should get hi back. + Tag x{2, "Two-x"}; + Tag y{0, "Zero-y"}; + Tag z{1, "One-z"}; + assert(eq(std::clamp(x, y, z), z)); + assert(eq(std::clamp(y, z, x), z)); + } + + { + typedef int T; + constexpr T x = 1; + constexpr T y = 0; + constexpr T z = 1; + static_assert(std::clamp(x, y, z) == x, "" ); + static_assert(std::clamp(y, x, z) == x, "" ); + } +} diff --git a/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap_comp.pass.cpp index 4cde1a7d32eb..0e16d9bd17c7 100644 --- a/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap_comp.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap_comp.pass.cpp @@ -69,7 +69,7 @@ void test(unsigned N) std::random_shuffle(ia, ia+N); std::make_heap(ia, ia+N, std::ref(pred)); assert(pred.count() <= 3*N); - assert(std::is_heap(ia, ia+N, pred)); + assert(std::is_heap(ia, ia+N, pred)); } delete [] ia; diff --git a/test/std/algorithms/alg.sorting/alg.merge/inplace_merge.pass.cpp b/test/std/algorithms/alg.sorting/alg.merge/inplace_merge.pass.cpp index 829157353fb3..9c411730196c 100644 --- a/test/std/algorithms/alg.sorting/alg.merge/inplace_merge.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.merge/inplace_merge.pass.cpp @@ -24,20 +24,20 @@ struct S { S() : i_(0) {} S(int i) : i_(i) {} - + S(const S& rhs) : i_(rhs.i_) {} S( S&& rhs) : i_(rhs.i_) { rhs.i_ = -1; } - + S& operator =(const S& rhs) { i_ = rhs.i_; return *this; } S& operator =( S&& rhs) { i_ = rhs.i_; rhs.i_ = -2; assert(this != &rhs); return *this; } S& operator =(int i) { i_ = i; return *this; } - + bool operator <(const S& rhs) const { return i_ < rhs.i_; } bool operator ==(const S& rhs) const { return i_ == rhs.i_; } bool operator ==(int i) const { return i_ == i; } void set(int i) { i_ = i; } - + int i_; }; #endif diff --git a/test/std/algorithms/alg.sorting/alg.merge/inplace_merge_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.merge/inplace_merge_comp.pass.cpp index ca6f8e40cbd3..b4d25a93e50e 100644 --- a/test/std/algorithms/alg.sorting/alg.merge/inplace_merge_comp.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.merge/inplace_merge_comp.pass.cpp @@ -34,21 +34,21 @@ struct indirect_less struct S { S() : i_(0) {} S(int i) : i_(i) {} - + S(const S& rhs) : i_(rhs.i_) {} S( S&& rhs) : i_(rhs.i_) { rhs.i_ = -1; } - + S& operator =(const S& rhs) { i_ = rhs.i_; return *this; } S& operator =( S&& rhs) { i_ = rhs.i_; rhs.i_ = -2; assert(this != &rhs); return *this; } S& operator =(int i) { i_ = i; return *this; } - + bool operator <(const S& rhs) const { return i_ < rhs.i_; } bool operator >(const S& rhs) const { return i_ > rhs.i_; } bool operator ==(const S& rhs) const { return i_ == rhs.i_; } bool operator ==(int i) const { return i_ == i; } void set(int i) { i_ = i; } - + int i_; }; diff --git a/test/std/algorithms/alg.sorting/alg.min.max/max_element.pass.cpp b/test/std/algorithms/alg.sorting/alg.min.max/max_element.pass.cpp index 2197b97d7f2a..3ecc250a9c8f 100644 --- a/test/std/algorithms/alg.sorting/alg.min.max/max_element.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.min.max/max_element.pass.cpp @@ -57,13 +57,13 @@ test() test<Iter>(1000); } -#if __cplusplus >= 201402L +#if TEST_STD_VER >= 14 constexpr int il[] = { 2, 4, 6, 8, 7, 5, 3, 1 }; #endif void constexpr_test() { -#if __cplusplus >= 201402L +#if TEST_STD_VER >= 14 constexpr auto p = std::max_element(il,il+8); static_assert ( *p == 8, "" ); #endif @@ -75,6 +75,6 @@ int main() test<bidirectional_iterator<const int*> >(); test<random_access_iterator<const int*> >(); test<const int*>(); - + constexpr_test (); } diff --git a/test/std/algorithms/alg.sorting/alg.min.max/max_element_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.min.max/max_element_comp.pass.cpp index 37c181393aa6..fc88268aa84b 100644 --- a/test/std/algorithms/alg.sorting/alg.min.max/max_element_comp.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.min.max/max_element_comp.pass.cpp @@ -75,14 +75,14 @@ void test_eq() delete [] a; } -#if __cplusplus >= 201402L +#if TEST_STD_VER >= 14 constexpr int il[] = { 2, 4, 6, 8, 7, 5, 3, 1 }; struct less { constexpr bool operator ()( const int &x, const int &y) const { return x < y; }}; #endif void constexpr_test() { -#if __cplusplus >= 201402L +#if TEST_STD_VER >= 14 constexpr auto p = std::max_element(il, il+8, less()); static_assert ( *p == 8, "" ); #endif @@ -95,6 +95,6 @@ int main() test<random_access_iterator<const int*> >(); test<const int*>(); test_eq(); - + constexpr_test(); } diff --git a/test/std/algorithms/alg.sorting/alg.min.max/min_element.pass.cpp b/test/std/algorithms/alg.sorting/alg.min.max/min_element.pass.cpp index a9a9d61340f9..45dd54b1ee40 100644 --- a/test/std/algorithms/alg.sorting/alg.min.max/min_element.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.min.max/min_element.pass.cpp @@ -57,13 +57,13 @@ test() test<Iter>(1000); } -#if __cplusplus >= 201402L +#if TEST_STD_VER >= 14 constexpr int il[] = { 2, 4, 6, 8, 7, 5, 3, 1 }; #endif void constexpr_test() { -#if __cplusplus >= 201402L +#if TEST_STD_VER >= 14 constexpr auto p = std::min_element(il, il+8); static_assert ( *p == 1, "" ); #endif diff --git a/test/std/algorithms/alg.sorting/alg.min.max/min_element_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.min.max/min_element_comp.pass.cpp index 9517f7eac945..94ef482ddbde 100644 --- a/test/std/algorithms/alg.sorting/alg.min.max/min_element_comp.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.min.max/min_element_comp.pass.cpp @@ -75,14 +75,14 @@ void test_eq() delete [] a; } -#if __cplusplus >= 201402L +#if TEST_STD_VER >= 14 constexpr int il[] = { 2, 4, 6, 8, 7, 5, 3, 1 }; struct less { constexpr bool operator ()( const int &x, const int &y) const { return x < y; }}; #endif void constexpr_test() { -#if __cplusplus >= 201402L +#if TEST_STD_VER >= 14 constexpr auto p = std::min_element(il, il+8, less()); static_assert(*p == 1, ""); #endif @@ -95,6 +95,6 @@ int main() test<random_access_iterator<const int*> >(); test<const int*>(); test_eq(); - + constexpr_test(); } diff --git a/test/std/algorithms/alg.sorting/alg.min.max/minmax.pass.cpp b/test/std/algorithms/alg.sorting/alg.min.max/minmax.pass.cpp index 6ac972a2547b..8276c3a5dfd5 100644 --- a/test/std/algorithms/alg.sorting/alg.min.max/minmax.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.min.max/minmax.pass.cpp @@ -47,7 +47,7 @@ int main() } #if _LIBCPP_STD_VER > 11 { -// Note that you can't take a reference to a local var, since +// Note that you can't take a reference to a local var, since // its address is not a compile-time constant. constexpr static int x = 1; constexpr static int y = 0; diff --git a/test/std/algorithms/alg.sorting/alg.min.max/minmax_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.min.max/minmax_comp.pass.cpp index 771c8f84a740..3289f8a7582c 100644 --- a/test/std/algorithms/alg.sorting/alg.min.max/minmax_comp.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.min.max/minmax_comp.pass.cpp @@ -50,7 +50,7 @@ int main() } #if _LIBCPP_STD_VER > 11 { -// Note that you can't take a reference to a local var, since +// Note that you can't take a reference to a local var, since // its address is not a compile-time constant. constexpr static int x = 1; constexpr static int y = 0; diff --git a/test/std/algorithms/alg.sorting/alg.min.max/minmax_element.pass.cpp b/test/std/algorithms/alg.sorting/alg.min.max/minmax_element.pass.cpp index 915b1d176ab4..ef5474091db5 100644 --- a/test/std/algorithms/alg.sorting/alg.min.max/minmax_element.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.min.max/minmax_element.pass.cpp @@ -74,13 +74,13 @@ test() } } -#if __cplusplus >= 201402L +#if TEST_STD_VER >= 14 constexpr int il[] = { 2, 4, 6, 8, 7, 5, 3, 1 }; #endif void constexpr_test() { -#if __cplusplus >= 201402L +#if TEST_STD_VER >= 14 constexpr auto p = std::minmax_element(il, il+8); static_assert ( *(p.first) == 1, "" ); static_assert ( *(p.second) == 8, "" ); @@ -93,6 +93,6 @@ int main() test<bidirectional_iterator<const int*> >(); test<random_access_iterator<const int*> >(); test<const int*>(); - + constexpr_test(); } diff --git a/test/std/algorithms/alg.sorting/alg.min.max/minmax_element_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.min.max/minmax_element_comp.pass.cpp index d3a067fda3c5..3a0c2dbbba1b 100644 --- a/test/std/algorithms/alg.sorting/alg.min.max/minmax_element_comp.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.min.max/minmax_element_comp.pass.cpp @@ -79,14 +79,14 @@ test() } } -#if __cplusplus >= 201402L +#if TEST_STD_VER >= 14 constexpr int il[] = { 2, 4, 6, 8, 7, 5, 3, 1 }; struct less { constexpr bool operator ()( const int &x, const int &y) const { return x < y; }}; #endif void constexpr_test() { -#if __cplusplus >= 201402L +#if TEST_STD_VER >= 14 constexpr auto p = std::minmax_element(il, il+8, less()); static_assert ( *(p.first) == 1, "" ); static_assert ( *(p.second) == 8, "" ); @@ -99,6 +99,6 @@ int main() test<bidirectional_iterator<const int*> >(); test<random_access_iterator<const int*> >(); test<const int*>(); - + constexpr_test(); } diff --git a/test/std/algorithms/alg.sorting/alg.min.max/minmax_init_list_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.min.max/minmax_init_list_comp.pass.cpp index a66b2ff27cb0..789ccef0fca4 100644 --- a/test/std/algorithms/alg.sorting/alg.min.max/minmax_init_list_comp.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.min.max/minmax_init_list_comp.pass.cpp @@ -21,7 +21,7 @@ #include "counting_predicates.hpp" -bool all_equal(int a, int b) { return false; } // everything is equal +bool all_equal(int, int) { return false; } // everything is equal #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS void test_all_equal(std::initializer_list<int> il) diff --git a/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort.pass.cpp b/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort.pass.cpp index 7bb43461cba4..62458eca9302 100644 --- a/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort.pass.cpp @@ -22,13 +22,17 @@ void test_larger_sorts(unsigned N, unsigned M) { assert(N != 0); + assert(N >= M); int* array = new int[N]; for (int i = 0; i < N; ++i) array[i] = i; std::random_shuffle(array, array+N); std::partial_sort(array, array+M, array+N); for (int i = 0; i < M; ++i) + { + assert(i < N); // quiet analysis warnings assert(array[i] == i); + } delete [] array; } diff --git a/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.pass.cpp index d822f6c388c1..0289cf8391f9 100644 --- a/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.pass.cpp @@ -35,13 +35,17 @@ void test_larger_sorts(unsigned N, unsigned M) { assert(N != 0); + assert(N >= M); int* array = new int[N]; for (int i = 0; i < N; ++i) array[i] = i; std::random_shuffle(array, array+N); std::partial_sort(array, array+M, array+N, std::greater<int>()); for (int i = 0; i < M; ++i) + { + assert(i < N); // quiet analysis warnings assert(array[i] == N-i-1); + } delete [] array; } @@ -62,6 +66,7 @@ test_larger_sorts(unsigned N) int main() { + { int i = 0; std::partial_sort(&i, &i, &i); assert(i == 0); @@ -73,6 +78,7 @@ int main() test_larger_sorts(997); test_larger_sorts(1000); test_larger_sorts(1009); + } #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { diff --git a/test/std/algorithms/version.pass.cpp b/test/std/algorithms/version.pass.cpp deleted file mode 100644 index 20f0637e641b..000000000000 --- a/test/std/algorithms/version.pass.cpp +++ /dev/null @@ -1,20 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <algorithm> - -#include <algorithm> - -#ifndef _LIBCPP_VERSION -#error _LIBCPP_VERSION not defined -#endif - -int main() -{ -} |