summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/algorithms/alg.sorting
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2016-12-11 05:31:00 +0000
committerEric Fiselier <eric@efcs.ca>2016-12-11 05:31:00 +0000
commitc71bd55b5dd20dd94c5b87a30adb1da7e81c5114 (patch)
tree51ebcc46d3d70c5c3d18b752ab7e2910ff481f78 /libcxx/test/std/algorithms/alg.sorting
parent72967a56e17c3ba7f1f689aaf569dd0648a1d3df (diff)
downloadbcm5719-llvm-c71bd55b5dd20dd94c5b87a30adb1da7e81c5114.tar.gz
bcm5719-llvm-c71bd55b5dd20dd94c5b87a30adb1da7e81c5114.zip
Enable the -Wsign-compare warning to better support MSVC
llvm-svn: 289363
Diffstat (limited to 'libcxx/test/std/algorithms/alg.sorting')
-rw-r--r--libcxx/test/std/algorithms/alg.sorting/alg.binary.search/binary.search/binary_search_comp.pass.cpp2
-rw-r--r--libcxx/test/std/algorithms/alg.sorting/alg.binary.search/equal.range/equal_range.pass.cpp2
-rw-r--r--libcxx/test/std/algorithms/alg.sorting/alg.binary.search/equal.range/equal_range_comp.pass.cpp2
-rw-r--r--libcxx/test/std/algorithms/alg.sorting/alg.binary.search/lower.bound/lower_bound.pass.cpp2
-rw-r--r--libcxx/test/std/algorithms/alg.sorting/alg.binary.search/lower.bound/lower_bound_comp.pass.cpp2
-rw-r--r--libcxx/test/std/algorithms/alg.sorting/alg.binary.search/upper.bound/upper_bound.pass.cpp2
-rw-r--r--libcxx/test/std/algorithms/alg.sorting/alg.binary.search/upper.bound/upper_bound_comp.pass.cpp2
-rw-r--r--libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap_comp.pass.cpp18
-rw-r--r--libcxx/test/std/algorithms/alg.sorting/alg.merge/inplace_merge_comp.pass.cpp6
-rw-r--r--libcxx/test/std/algorithms/alg.sorting/alg.min.max/max_element_comp.pass.cpp3
-rw-r--r--libcxx/test/std/algorithms/alg.sorting/alg.min.max/min_element_comp.pass.cpp3
-rw-r--r--libcxx/test/std/algorithms/alg.sorting/alg.min.max/minmax_element.pass.cpp2
-rw-r--r--libcxx/test/std/algorithms/alg.sorting/alg.min.max/minmax_element_comp.pass.cpp3
-rw-r--r--libcxx/test/std/algorithms/alg.sorting/alg.sort/sort/sort.pass.cpp2
-rw-r--r--libcxx/test/std/algorithms/alg.sorting/alg.sort/stable.sort/stable_sort.pass.cpp2
15 files changed, 27 insertions, 26 deletions
diff --git a/libcxx/test/std/algorithms/alg.sorting/alg.binary.search/binary.search/binary_search_comp.pass.cpp b/libcxx/test/std/algorithms/alg.sorting/alg.binary.search/binary.search/binary_search_comp.pass.cpp
index 802d897670c..e0b148499ca 100644
--- a/libcxx/test/std/algorithms/alg.sorting/alg.binary.search/binary.search/binary_search_comp.pass.cpp
+++ b/libcxx/test/std/algorithms/alg.sorting/alg.binary.search/binary.search/binary_search_comp.pass.cpp
@@ -35,7 +35,7 @@ void
test()
{
const unsigned N = 1000;
- const unsigned M = 10;
+ const int M = 10;
std::vector<int> v(N);
int x = 0;
for (std::size_t i = 0; i < v.size(); ++i)
diff --git a/libcxx/test/std/algorithms/alg.sorting/alg.binary.search/equal.range/equal_range.pass.cpp b/libcxx/test/std/algorithms/alg.sorting/alg.binary.search/equal.range/equal_range.pass.cpp
index 8c2b60819b0..bc968f5b2aa 100644
--- a/libcxx/test/std/algorithms/alg.sorting/alg.binary.search/equal.range/equal_range.pass.cpp
+++ b/libcxx/test/std/algorithms/alg.sorting/alg.binary.search/equal.range/equal_range.pass.cpp
@@ -42,7 +42,7 @@ void
test()
{
const unsigned N = 1000;
- const unsigned M = 10;
+ const int M = 10;
std::vector<int> v(N);
int x = 0;
for (std::size_t i = 0; i < v.size(); ++i)
diff --git a/libcxx/test/std/algorithms/alg.sorting/alg.binary.search/equal.range/equal_range_comp.pass.cpp b/libcxx/test/std/algorithms/alg.sorting/alg.binary.search/equal.range/equal_range_comp.pass.cpp
index c2d92d92081..de0bbf25613 100644
--- a/libcxx/test/std/algorithms/alg.sorting/alg.binary.search/equal.range/equal_range_comp.pass.cpp
+++ b/libcxx/test/std/algorithms/alg.sorting/alg.binary.search/equal.range/equal_range_comp.pass.cpp
@@ -43,7 +43,7 @@ void
test()
{
const unsigned N = 1000;
- const unsigned M = 10;
+ const int M = 10;
std::vector<int> v(N);
int x = 0;
for (std::size_t i = 0; i < v.size(); ++i)
diff --git a/libcxx/test/std/algorithms/alg.sorting/alg.binary.search/lower.bound/lower_bound.pass.cpp b/libcxx/test/std/algorithms/alg.sorting/alg.binary.search/lower.bound/lower_bound.pass.cpp
index 2608104fca7..1fff1d7f5b6 100644
--- a/libcxx/test/std/algorithms/alg.sorting/alg.binary.search/lower.bound/lower_bound.pass.cpp
+++ b/libcxx/test/std/algorithms/alg.sorting/alg.binary.search/lower.bound/lower_bound.pass.cpp
@@ -37,7 +37,7 @@ void
test()
{
const unsigned N = 1000;
- const unsigned M = 10;
+ const int M = 10;
std::vector<int> v(N);
int x = 0;
for (std::size_t i = 0; i < v.size(); ++i)
diff --git a/libcxx/test/std/algorithms/alg.sorting/alg.binary.search/lower.bound/lower_bound_comp.pass.cpp b/libcxx/test/std/algorithms/alg.sorting/alg.binary.search/lower.bound/lower_bound_comp.pass.cpp
index 6a5463246c7..4ec5f6c000d 100644
--- a/libcxx/test/std/algorithms/alg.sorting/alg.binary.search/lower.bound/lower_bound_comp.pass.cpp
+++ b/libcxx/test/std/algorithms/alg.sorting/alg.binary.search/lower.bound/lower_bound_comp.pass.cpp
@@ -38,7 +38,7 @@ void
test()
{
const unsigned N = 1000;
- const unsigned M = 10;
+ const int M = 10;
std::vector<int> v(N);
int x = 0;
for (std::size_t i = 0; i < v.size(); ++i)
diff --git a/libcxx/test/std/algorithms/alg.sorting/alg.binary.search/upper.bound/upper_bound.pass.cpp b/libcxx/test/std/algorithms/alg.sorting/alg.binary.search/upper.bound/upper_bound.pass.cpp
index 106f1499e99..710edb61c9b 100644
--- a/libcxx/test/std/algorithms/alg.sorting/alg.binary.search/upper.bound/upper_bound.pass.cpp
+++ b/libcxx/test/std/algorithms/alg.sorting/alg.binary.search/upper.bound/upper_bound.pass.cpp
@@ -37,7 +37,7 @@ void
test()
{
const unsigned N = 1000;
- const unsigned M = 10;
+ const int M = 10;
std::vector<int> v(N);
int x = 0;
for (std::size_t i = 0; i < v.size(); ++i)
diff --git a/libcxx/test/std/algorithms/alg.sorting/alg.binary.search/upper.bound/upper_bound_comp.pass.cpp b/libcxx/test/std/algorithms/alg.sorting/alg.binary.search/upper.bound/upper_bound_comp.pass.cpp
index 3fa346131ac..3268075b1b0 100644
--- a/libcxx/test/std/algorithms/alg.sorting/alg.binary.search/upper.bound/upper_bound_comp.pass.cpp
+++ b/libcxx/test/std/algorithms/alg.sorting/alg.binary.search/upper.bound/upper_bound_comp.pass.cpp
@@ -38,7 +38,7 @@ void
test()
{
const unsigned N = 1000;
- const unsigned M = 10;
+ const int M = 10;
std::vector<int> v(N);
int x = 0;
for (std::size_t i = 0; i < v.size(); ++i)
diff --git a/libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap_comp.pass.cpp b/libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap_comp.pass.cpp
index 0e16d9bd17c..9d0545f0d9c 100644
--- a/libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap_comp.pass.cpp
+++ b/libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap_comp.pass.cpp
@@ -16,13 +16,12 @@
#include <algorithm>
#include <functional>
+#include <memory>
#include <cassert>
+#include "test_macros.h"
#include "counting_predicates.hpp"
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#include <memory>
-
struct indirect_less
{
template <class P>
@@ -30,9 +29,8 @@ struct indirect_less
{return *x < *y;}
};
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-void test(unsigned N)
+void test(int N)
{
int* ia = new int [N];
{
@@ -49,7 +47,7 @@ void test(unsigned N)
for (int i = 0; i < N; ++i)
ia[i] = i;
std::make_heap(ia, ia+N, std::ref(pred));
- assert(pred.count() <= 3*N);
+ assert(pred.count() <= 3u*N);
assert(std::is_heap(ia, ia+N, pred));
}
@@ -59,7 +57,7 @@ void test(unsigned N)
for (int i = 0; i < N; ++i)
ia[N-1-i] = i;
std::make_heap(ia, ia+N, std::ref(pred));
- assert(pred.count() <= 3*N);
+ assert(pred.count() <= 3u*N);
assert(std::is_heap(ia, ia+N, pred));
}
@@ -68,7 +66,7 @@ void test(unsigned N)
binary_counting_predicate<std::greater<int>, int, int> pred ((std::greater<int>()));
std::random_shuffle(ia, ia+N);
std::make_heap(ia, ia+N, std::ref(pred));
- assert(pred.count() <= 3*N);
+ assert(pred.count() <= 3u*N);
assert(std::is_heap(ia, ia+N, pred));
}
@@ -86,7 +84,7 @@ int main()
test(10000);
test(100000);
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if TEST_STD_VER >= 11
{
const int N = 1000;
std::unique_ptr<int>* ia = new std::unique_ptr<int> [N];
@@ -97,5 +95,5 @@ int main()
assert(std::is_heap(ia, ia+N, indirect_less()));
delete [] ia;
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif
}
diff --git a/libcxx/test/std/algorithms/alg.sorting/alg.merge/inplace_merge_comp.pass.cpp b/libcxx/test/std/algorithms/alg.sorting/alg.merge/inplace_merge_comp.pass.cpp
index b4d25a93e50..fd9e5f13c26 100644
--- a/libcxx/test/std/algorithms/alg.sorting/alg.merge/inplace_merge_comp.pass.cpp
+++ b/libcxx/test/std/algorithms/alg.sorting/alg.merge/inplace_merge_comp.pass.cpp
@@ -74,7 +74,7 @@ test_one(unsigned N, unsigned M)
std::inplace_merge(Iter(ia), Iter(ia+M), Iter(ia+N), std::ref(pred));
if(N > 0)
{
- assert(ia[0] == N-1);
+ assert(ia[0] == static_cast<int>(N)-1);
assert(ia[N-1] == 0);
assert(std::is_sorted(ia, ia+N, std::greater<value_type>()));
assert(pred.count() <= (N-1));
@@ -125,10 +125,10 @@ int main()
test<S*>();
{
- unsigned N = 100;
+ int N = 100;
unsigned M = 50;
std::unique_ptr<int>* ia = new std::unique_ptr<int>[N];
- for (unsigned i = 0; i < N; ++i)
+ for (int i = 0; i < N; ++i)
ia[i].reset(new int(i));
std::random_shuffle(ia, ia+N);
std::sort(ia, ia+M, indirect_less());
diff --git a/libcxx/test/std/algorithms/alg.sorting/alg.min.max/max_element_comp.pass.cpp b/libcxx/test/std/algorithms/alg.sorting/alg.min.max/max_element_comp.pass.cpp
index 2e8e0c30d94..e60e156455f 100644
--- a/libcxx/test/std/algorithms/alg.sorting/alg.min.max/max_element_comp.pass.cpp
+++ b/libcxx/test/std/algorithms/alg.sorting/alg.min.max/max_element_comp.pass.cpp
@@ -18,6 +18,7 @@
#include <functional>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
template <class Iter>
@@ -66,7 +67,7 @@ void test_eq0(Iter first, Iter last, Pred p)
void test_eq()
{
- const size_t N = 10;
+ const int N = 10;
int* a = new int[N];
for (int i = 0; i < N; ++i)
a[i] = 10; // all the same
diff --git a/libcxx/test/std/algorithms/alg.sorting/alg.min.max/min_element_comp.pass.cpp b/libcxx/test/std/algorithms/alg.sorting/alg.min.max/min_element_comp.pass.cpp
index 0f5c80c0d25..c4c6e31eb6d 100644
--- a/libcxx/test/std/algorithms/alg.sorting/alg.min.max/min_element_comp.pass.cpp
+++ b/libcxx/test/std/algorithms/alg.sorting/alg.min.max/min_element_comp.pass.cpp
@@ -18,6 +18,7 @@
#include <functional>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
template <class Iter>
@@ -66,7 +67,7 @@ void test_eq0(Iter first, Iter last, Pred p)
void test_eq()
{
- const size_t N = 10;
+ const int N = 10;
int* a = new int[N];
for (int i = 0; i < N; ++i)
a[i] = 10; // all the same
diff --git a/libcxx/test/std/algorithms/alg.sorting/alg.min.max/minmax_element.pass.cpp b/libcxx/test/std/algorithms/alg.sorting/alg.min.max/minmax_element.pass.cpp
index fc97778347b..c2805a65613 100644
--- a/libcxx/test/std/algorithms/alg.sorting/alg.min.max/minmax_element.pass.cpp
+++ b/libcxx/test/std/algorithms/alg.sorting/alg.min.max/minmax_element.pass.cpp
@@ -62,7 +62,7 @@ test()
test<Iter>(10);
test<Iter>(1000);
{
- const unsigned N = 100;
+ const int N = 100;
int* a = new int[N];
for (int i = 0; i < N; ++i)
a[i] = 5;
diff --git a/libcxx/test/std/algorithms/alg.sorting/alg.min.max/minmax_element_comp.pass.cpp b/libcxx/test/std/algorithms/alg.sorting/alg.min.max/minmax_element_comp.pass.cpp
index a39512f2e63..7840638f742 100644
--- a/libcxx/test/std/algorithms/alg.sorting/alg.min.max/minmax_element_comp.pass.cpp
+++ b/libcxx/test/std/algorithms/alg.sorting/alg.min.max/minmax_element_comp.pass.cpp
@@ -18,6 +18,7 @@
#include <functional>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
template <class Iter>
@@ -65,7 +66,7 @@ test()
test<Iter>(10);
test<Iter>(1000);
{
- const unsigned N = 100;
+ const int N = 100;
int* a = new int[N];
for (int i = 0; i < N; ++i)
a[i] = 5;
diff --git a/libcxx/test/std/algorithms/alg.sorting/alg.sort/sort/sort.pass.cpp b/libcxx/test/std/algorithms/alg.sorting/alg.sort/sort/sort.pass.cpp
index ea1e7dfe9fa..689433f9e45 100644
--- a/libcxx/test/std/algorithms/alg.sorting/alg.sort/sort/sort.pass.cpp
+++ b/libcxx/test/std/algorithms/alg.sorting/alg.sort/sort/sort.pass.cpp
@@ -63,7 +63,7 @@ test_sort_driver(RI f, RI l, int start)
test_sort_driver_driver(f, l, start, l);
}
-template <unsigned sa>
+template <int sa>
void
test_sort_()
{
diff --git a/libcxx/test/std/algorithms/alg.sorting/alg.sort/stable.sort/stable_sort.pass.cpp b/libcxx/test/std/algorithms/alg.sorting/alg.sort/stable.sort/stable_sort.pass.cpp
index 74a876cee19..336fcd0b3dd 100644
--- a/libcxx/test/std/algorithms/alg.sorting/alg.sort/stable.sort/stable_sort.pass.cpp
+++ b/libcxx/test/std/algorithms/alg.sorting/alg.sort/stable.sort/stable_sort.pass.cpp
@@ -63,7 +63,7 @@ test_sort_driver(RI f, RI l, int start)
test_sort_driver_driver(f, l, start, l);
}
-template <unsigned sa>
+template <int sa>
void
test_sort_()
{
OpenPOWER on IntegriCloud