aboutsummaryrefslogtreecommitdiff
path: root/test/std/algorithms/alg.sorting/alg.min.max
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-01-02 19:18:58 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-01-02 19:18:58 +0000
commit53a420fba21cf1644972b34dcd811a43cdb8368d (patch)
tree66a19f6f8b65215772549a51d688492ab8addc0d /test/std/algorithms/alg.sorting/alg.min.max
parentb50f1549701eb950921e5d6f2e55ba1a1dadbb43 (diff)
Notes
Diffstat (limited to 'test/std/algorithms/alg.sorting/alg.min.max')
-rw-r--r--test/std/algorithms/alg.sorting/alg.min.max/max.pass.cpp4
-rw-r--r--test/std/algorithms/alg.sorting/alg.min.max/max_comp.pass.cpp4
-rw-r--r--test/std/algorithms/alg.sorting/alg.min.max/max_element.pass.cpp2
-rw-r--r--test/std/algorithms/alg.sorting/alg.min.max/max_element_comp.pass.cpp5
-rw-r--r--test/std/algorithms/alg.sorting/alg.min.max/max_init_list.pass.cpp8
-rw-r--r--test/std/algorithms/alg.sorting/alg.min.max/max_init_list_comp.pass.cpp8
-rw-r--r--test/std/algorithms/alg.sorting/alg.min.max/min.pass.cpp4
-rw-r--r--test/std/algorithms/alg.sorting/alg.min.max/min_comp.pass.cpp4
-rw-r--r--test/std/algorithms/alg.sorting/alg.min.max/min_element.pass.cpp2
-rw-r--r--test/std/algorithms/alg.sorting/alg.min.max/min_element_comp.pass.cpp5
-rw-r--r--test/std/algorithms/alg.sorting/alg.min.max/min_init_list.pass.cpp8
-rw-r--r--test/std/algorithms/alg.sorting/alg.min.max/min_init_list_comp.pass.cpp8
-rw-r--r--test/std/algorithms/alg.sorting/alg.min.max/minmax.pass.cpp4
-rw-r--r--test/std/algorithms/alg.sorting/alg.min.max/minmax_comp.pass.cpp4
-rw-r--r--test/std/algorithms/alg.sorting/alg.min.max/minmax_element.pass.cpp4
-rw-r--r--test/std/algorithms/alg.sorting/alg.min.max/minmax_element_comp.pass.cpp5
-rw-r--r--test/std/algorithms/alg.sorting/alg.min.max/minmax_init_list.pass.cpp8
-rw-r--r--test/std/algorithms/alg.sorting/alg.min.max/minmax_init_list_comp.pass.cpp9
18 files changed, 60 insertions, 36 deletions
diff --git a/test/std/algorithms/alg.sorting/alg.min.max/max.pass.cpp b/test/std/algorithms/alg.sorting/alg.min.max/max.pass.cpp
index c560c22f2d72..f453a234d2e1 100644
--- a/test/std/algorithms/alg.sorting/alg.min.max/max.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.min.max/max.pass.cpp
@@ -16,6 +16,8 @@
#include <algorithm>
#include <cassert>
+#include "test_macros.h"
+
template <class T>
void
test(const T& a, const T& b, const T& x)
@@ -43,7 +45,7 @@ int main()
test(x, y, x);
test(y, x, x);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER >= 14
{
constexpr int x = 1;
constexpr int y = 0;
diff --git a/test/std/algorithms/alg.sorting/alg.min.max/max_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.min.max/max_comp.pass.cpp
index 95241af50063..6c185c2a8036 100644
--- a/test/std/algorithms/alg.sorting/alg.min.max/max_comp.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.min.max/max_comp.pass.cpp
@@ -18,6 +18,8 @@
#include <functional>
#include <cassert>
+#include "test_macros.h"
+
template <class T, class C>
void
test(const T& a, const T& b, C c, const T& x)
@@ -45,7 +47,7 @@ int main()
test(x, y, std::greater<int>(), y);
test(y, x, std::greater<int>(), y);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER >= 14
{
constexpr int x = 1;
constexpr int y = 0;
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 3ecc250a9c8f..e9cd086ab13d 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
@@ -35,7 +35,7 @@ test(Iter first, Iter last)
template <class Iter>
void
-test(unsigned N)
+test(int N)
{
int* a = new int[N];
for (int i = 0; i < N; ++i)
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 fc88268aa84b..e60e156455f3 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
@@ -18,6 +18,7 @@
#include <functional>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
template <class Iter>
@@ -36,7 +37,7 @@ test(Iter first, Iter last)
template <class Iter>
void
-test(unsigned N)
+test(int N)
{
int* a = new int[N];
for (int i = 0; i < N; ++i)
@@ -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/test/std/algorithms/alg.sorting/alg.min.max/max_init_list.pass.cpp b/test/std/algorithms/alg.sorting/alg.min.max/max_init_list.pass.cpp
index 0438412d236e..e003acaa5aa8 100644
--- a/test/std/algorithms/alg.sorting/alg.min.max/max_init_list.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.min.max/max_init_list.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <algorithm>
// template <class T>
@@ -16,9 +18,10 @@
#include <algorithm>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
int i = std::max({2, 3, 1});
assert(i == 3);
i = std::max({2, 1, 3});
@@ -31,12 +34,11 @@ int main()
assert(i == 3);
i = std::max({1, 3, 2});
assert(i == 3);
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER >= 14
{
static_assert(std::max({1, 3, 2}) == 3, "");
static_assert(std::max({2, 1, 3}) == 3, "");
static_assert(std::max({3, 2, 1}) == 3, "");
}
#endif
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
diff --git a/test/std/algorithms/alg.sorting/alg.min.max/max_init_list_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.min.max/max_init_list_comp.pass.cpp
index 4dd47a73ef3b..6b3c72b1de9e 100644
--- a/test/std/algorithms/alg.sorting/alg.min.max/max_init_list_comp.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.min.max/max_init_list_comp.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <algorithm>
// template<class T, class Compare>
@@ -17,9 +19,10 @@
#include <functional>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
int i = std::max({2, 3, 1}, std::greater<int>());
assert(i == 1);
i = std::max({2, 1, 3}, std::greater<int>());
@@ -32,12 +35,11 @@ int main()
assert(i == 1);
i = std::max({1, 3, 2}, std::greater<int>());
assert(i == 1);
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER >= 14
{
static_assert(std::max({1, 3, 2}, std::greater<int>()) == 1, "");
static_assert(std::max({2, 1, 3}, std::greater<int>()) == 1, "");
static_assert(std::max({3, 2, 1}, std::greater<int>()) == 1, "");
}
#endif
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
diff --git a/test/std/algorithms/alg.sorting/alg.min.max/min.pass.cpp b/test/std/algorithms/alg.sorting/alg.min.max/min.pass.cpp
index bbbd97bc5a4a..3d0241f80dbe 100644
--- a/test/std/algorithms/alg.sorting/alg.min.max/min.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.min.max/min.pass.cpp
@@ -16,6 +16,8 @@
#include <algorithm>
#include <cassert>
+#include "test_macros.h"
+
template <class T>
void
test(const T& a, const T& b, const T& x)
@@ -43,7 +45,7 @@ int main()
test(x, y, y);
test(y, x, y);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER >= 14
{
constexpr int x = 1;
constexpr int y = 0;
diff --git a/test/std/algorithms/alg.sorting/alg.min.max/min_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.min.max/min_comp.pass.cpp
index 4ef705e77718..9dc74380261b 100644
--- a/test/std/algorithms/alg.sorting/alg.min.max/min_comp.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.min.max/min_comp.pass.cpp
@@ -18,6 +18,8 @@
#include <functional>
#include <cassert>
+#include "test_macros.h"
+
template <class T, class C>
void
test(const T& a, const T& b, C c, const T& x)
@@ -45,7 +47,7 @@ int main()
test(x, y, std::greater<int>(), x);
test(y, x, std::greater<int>(), x);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER >= 14
{
constexpr int x = 1;
constexpr int y = 0;
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 45dd54b1ee40..c41884220857 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
@@ -35,7 +35,7 @@ test(Iter first, Iter last)
template <class Iter>
void
-test(unsigned N)
+test(int N)
{
int* a = new int[N];
for (int i = 0; i < N; ++i)
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 94ef482ddbde..c4c6e31eb6dd 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
@@ -18,6 +18,7 @@
#include <functional>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
template <class Iter>
@@ -36,7 +37,7 @@ test(Iter first, Iter last)
template <class Iter>
void
-test(unsigned N)
+test(int N)
{
int* a = new int[N];
for (int i = 0; i < N; ++i)
@@ -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/test/std/algorithms/alg.sorting/alg.min.max/min_init_list.pass.cpp b/test/std/algorithms/alg.sorting/alg.min.max/min_init_list.pass.cpp
index eed4ebd45756..d212bf6cfe88 100644
--- a/test/std/algorithms/alg.sorting/alg.min.max/min_init_list.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.min.max/min_init_list.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <algorithm>
// template<class T>
@@ -16,9 +18,10 @@
#include <algorithm>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
int i = std::min({2, 3, 1});
assert(i == 1);
i = std::min({2, 1, 3});
@@ -31,12 +34,11 @@ int main()
assert(i == 1);
i = std::min({1, 3, 2});
assert(i == 1);
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER >= 14
{
static_assert(std::min({1, 3, 2}) == 1, "");
static_assert(std::min({2, 1, 3}) == 1, "");
static_assert(std::min({3, 2, 1}) == 1, "");
}
#endif
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
diff --git a/test/std/algorithms/alg.sorting/alg.min.max/min_init_list_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.min.max/min_init_list_comp.pass.cpp
index 5e0301b657b9..7435da1661ad 100644
--- a/test/std/algorithms/alg.sorting/alg.min.max/min_init_list_comp.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.min.max/min_init_list_comp.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <algorithm>
// template<class T, class Compare>
@@ -17,9 +19,10 @@
#include <functional>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
int i = std::min({2, 3, 1}, std::greater<int>());
assert(i == 3);
i = std::min({2, 1, 3}, std::greater<int>());
@@ -32,12 +35,11 @@ int main()
assert(i == 3);
i = std::min({1, 3, 2}, std::greater<int>());
assert(i == 3);
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER >= 14
{
static_assert(std::min({1, 3, 2}, std::greater<int>()) == 3, "");
static_assert(std::min({2, 1, 3}, std::greater<int>()) == 3, "");
static_assert(std::min({3, 2, 1}, std::greater<int>()) == 3, "");
}
#endif
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
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 8276c3a5dfd5..6ef4d06467bf 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
@@ -16,6 +16,8 @@
#include <algorithm>
#include <cassert>
+#include "test_macros.h"
+
template <class T>
void
test(const T& a, const T& b, const T& x, const T& y)
@@ -45,7 +47,7 @@ int main()
test(x, y, y, x);
test(y, x, y, x);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER >= 14
{
// Note that you can't take a reference to a local var, since
// its address is not a compile-time constant.
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 3289f8a7582c..a2027d440c46 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
@@ -18,6 +18,8 @@
#include <functional>
#include <cassert>
+#include "test_macros.h"
+
template <class T, class C>
void
test(const T& a, const T& b, C c, const T& x, const T& y)
@@ -48,7 +50,7 @@ int main()
test(x, y, std::greater<int>(), x, y);
test(y, x, std::greater<int>(), x, y);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER >= 14
{
// Note that you can't take a reference to a local var, since
// its address is not a compile-time constant.
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 ef5474091db5..c2805a656137 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
@@ -41,7 +41,7 @@ test(Iter first, Iter last)
template <class Iter>
void
-test(unsigned N)
+test(int N)
{
int* a = new int[N];
for (int i = 0; i < N; ++i)
@@ -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/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 3a0c2dbbba1b..7840638f742c 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
@@ -18,6 +18,7 @@
#include <functional>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
template <class Iter>
@@ -44,7 +45,7 @@ test(Iter first, Iter last)
template <class Iter>
void
-test(unsigned N)
+test(int N)
{
int* a = new int[N];
for (int i = 0; i < N; ++i)
@@ -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/test/std/algorithms/alg.sorting/alg.min.max/minmax_init_list.pass.cpp b/test/std/algorithms/alg.sorting/alg.min.max/minmax_init_list.pass.cpp
index 0196d10dcd96..dd62dfd78a8d 100644
--- a/test/std/algorithms/alg.sorting/alg.min.max/minmax_init_list.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.min.max/minmax_init_list.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <algorithm>
// template<class T>
@@ -16,16 +18,17 @@
#include <algorithm>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
assert((std::minmax({1, 2, 3}) == std::pair<int, int>(1, 3)));
assert((std::minmax({1, 3, 2}) == std::pair<int, int>(1, 3)));
assert((std::minmax({2, 1, 3}) == std::pair<int, int>(1, 3)));
assert((std::minmax({2, 3, 1}) == std::pair<int, int>(1, 3)));
assert((std::minmax({3, 1, 2}) == std::pair<int, int>(1, 3)));
assert((std::minmax({3, 2, 1}) == std::pair<int, int>(1, 3)));
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER >= 14
{
static_assert((std::minmax({1, 2, 3}) == std::pair<int, int>(1, 3)), "");
static_assert((std::minmax({1, 3, 2}) == std::pair<int, int>(1, 3)), "");
@@ -35,5 +38,4 @@ int main()
static_assert((std::minmax({3, 2, 1}) == std::pair<int, int>(1, 3)), "");
}
#endif
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
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 789ccef0fca4..ab20b2a0461b 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
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <algorithm>
// template<class T, class Compare>
@@ -19,11 +21,11 @@
#include <functional>
#include <cassert>
+#include "test_macros.h"
#include "counting_predicates.hpp"
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)
{
binary_counting_predicate<bool(*)(int, int), int, int> pred (all_equal);
@@ -33,11 +35,9 @@ void test_all_equal(std::initializer_list<int> il)
assert(p.second == *--ptr);
assert(pred.count() <= ((3 * il.size()) / 2));
}
-#endif
int main()
{
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
assert((std::minmax({1, 2, 3}, std::greater<int>()) == std::pair<int, int>(3, 1)));
assert((std::minmax({1, 3, 2}, std::greater<int>()) == std::pair<int, int>(3, 1)));
assert((std::minmax({2, 1, 3}, std::greater<int>()) == std::pair<int, int>(3, 1)));
@@ -63,7 +63,7 @@ int main()
test_all_equal({0,1,2,3,4,5,6,7,8,9,10});
test_all_equal({0,1,2,3,4,5,6,7,8,9,10,11});
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER >= 14
{
static_assert((std::minmax({1, 2, 3}, std::greater<int>()) == std::pair<int, int>(3, 1)), "");
static_assert((std::minmax({1, 3, 2}, std::greater<int>()) == std::pair<int, int>(3, 1)), "");
@@ -73,5 +73,4 @@ int main()
static_assert((std::minmax({3, 2, 1}, std::greater<int>()) == std::pair<int, int>(3, 1)), "");
}
#endif
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}