US 122, N3106
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@111742 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -16,8 +16,20 @@
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
|
||||
#error max(initializer_list<T> t) is not implemented
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifdef _LIBCPP_MOVE
|
||||
int i = std::max({2, 3, 1});
|
||||
assert(i == 3);
|
||||
i = std::max({2, 1, 3});
|
||||
assert(i == 3);
|
||||
i = std::max({3, 1, 2});
|
||||
assert(i == 3);
|
||||
i = std::max({3, 2, 1});
|
||||
assert(i == 3);
|
||||
i = std::max({1, 2, 3});
|
||||
assert(i == 3);
|
||||
i = std::max({1, 3, 2});
|
||||
assert(i == 3);
|
||||
#endif
|
||||
}
|
||||
|
@@ -14,10 +14,23 @@
|
||||
// max(initializer_list<T> t, Compare comp);
|
||||
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <cassert>
|
||||
|
||||
#error max(initializer_list<T> t, Compare comp) is not implemented
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifdef _LIBCPP_MOVE
|
||||
int i = std::max({2, 3, 1}, std::greater<int>());
|
||||
assert(i == 1);
|
||||
i = std::max({2, 1, 3}, std::greater<int>());
|
||||
assert(i == 1);
|
||||
i = std::max({3, 1, 2}, std::greater<int>());
|
||||
assert(i == 1);
|
||||
i = std::max({3, 2, 1}, std::greater<int>());
|
||||
assert(i == 1);
|
||||
i = std::max({1, 2, 3}, std::greater<int>());
|
||||
assert(i == 1);
|
||||
i = std::max({1, 3, 2}, std::greater<int>());
|
||||
assert(i == 1);
|
||||
#endif
|
||||
}
|
||||
|
@@ -16,8 +16,20 @@
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
|
||||
#error min(initializer_list<T> t) is not implemented
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifdef _LIBCPP_MOVE
|
||||
int i = std::min({2, 3, 1});
|
||||
assert(i == 1);
|
||||
i = std::min({2, 1, 3});
|
||||
assert(i == 1);
|
||||
i = std::min({3, 1, 2});
|
||||
assert(i == 1);
|
||||
i = std::min({3, 2, 1});
|
||||
assert(i == 1);
|
||||
i = std::min({1, 2, 3});
|
||||
assert(i == 1);
|
||||
i = std::min({1, 3, 2});
|
||||
assert(i == 1);
|
||||
#endif
|
||||
}
|
||||
|
@@ -14,10 +14,23 @@
|
||||
// min(initializer_list<T> t, Compare comp);
|
||||
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <cassert>
|
||||
|
||||
#error min(initializer_list<T> t, Compare comp) is not implemented
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifdef _LIBCPP_MOVE
|
||||
int i = std::min({2, 3, 1}, std::greater<int>());
|
||||
assert(i == 3);
|
||||
i = std::min({2, 1, 3}, std::greater<int>());
|
||||
assert(i == 3);
|
||||
i = std::min({3, 1, 2}, std::greater<int>());
|
||||
assert(i == 3);
|
||||
i = std::min({3, 2, 1}, std::greater<int>());
|
||||
assert(i == 3);
|
||||
i = std::min({1, 2, 3}, std::greater<int>());
|
||||
assert(i == 3);
|
||||
i = std::min({1, 3, 2}, std::greater<int>());
|
||||
assert(i == 3);
|
||||
#endif
|
||||
}
|
||||
|
@@ -38,13 +38,13 @@ int main()
|
||||
{
|
||||
int x = 0;
|
||||
int y = 1;
|
||||
test(x, y, std::greater<int>(), x, y);
|
||||
test(y, x, std::greater<int>(), x, y);
|
||||
test(x, y, std::greater<int>(), y, x);
|
||||
test(y, x, std::greater<int>(), y, x);
|
||||
}
|
||||
{
|
||||
int x = 1;
|
||||
int y = 0;
|
||||
test(x, y, std::greater<int>(), y, x);
|
||||
test(y, x, std::greater<int>(), y, x);
|
||||
test(x, y, std::greater<int>(), x, y);
|
||||
test(y, x, std::greater<int>(), x, y);
|
||||
}
|
||||
}
|
||||
|
@@ -10,14 +10,20 @@
|
||||
// <algorithm>
|
||||
|
||||
// template<class T>
|
||||
// pair<const T&, const T&>
|
||||
// pair<T, T>
|
||||
// minmax(initializer_list<T> t);
|
||||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
|
||||
#error minmax(initializer_list<T> t) is not implemented
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifdef _LIBCPP_MOVE
|
||||
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)));
|
||||
#endif
|
||||
}
|
||||
|
@@ -10,14 +10,21 @@
|
||||
// <algorithm>
|
||||
|
||||
// template<class T, class Compare>
|
||||
// pair<const T&, const T&>
|
||||
// pair<T, T>
|
||||
// minmax(initializer_list<T> t, Compare comp);
|
||||
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <cassert>
|
||||
|
||||
#error minmax(initializer_list<T> t, Compare comp) is not implemented
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifdef _LIBCPP_MOVE
|
||||
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)));
|
||||
assert((std::minmax({2, 3, 1}, std::greater<int>()) == std::pair<int, int>(3, 1)));
|
||||
assert((std::minmax({3, 1, 2}, std::greater<int>()) == std::pair<int, int>(3, 1)));
|
||||
assert((std::minmax({3, 2, 1}, std::greater<int>()) == std::pair<int, int>(3, 1)));
|
||||
#endif
|
||||
}
|
||||
|
Reference in New Issue
Block a user