mirror of
https://github.com/llvm-mirror/libcxx.git
synced 2025-10-23 01:18:52 +08:00
Purge all usages of _LIBCPP_STD_VER under test/std/algorithm
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283643 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -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;
|
||||
|
@@ -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;
|
||||
|
@@ -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
|
||||
}
|
||||
|
@@ -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
|
||||
}
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
@@ -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
|
||||
}
|
||||
|
@@ -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
|
||||
}
|
||||
|
@@ -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.
|
||||
|
@@ -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.
|
||||
|
@@ -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
|
||||
}
|
||||
|
@@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user