From 4eb27b79c1cb002cea8d74f5b5796a610ed8ab8a Mon Sep 17 00:00:00 2001 From: Howard Hinnant Date: Sat, 21 Aug 2010 20:10:01 +0000 Subject: US 122, N3106 llvm-svn: 111742 --- .../alg.sorting/alg.min.max/max_init_list.pass.cpp | 16 ++++++++++++++-- .../alg.sorting/alg.min.max/max_init_list_comp.pass.cpp | 17 +++++++++++++++-- .../alg.sorting/alg.min.max/min_init_list.pass.cpp | 16 ++++++++++++++-- .../alg.sorting/alg.min.max/min_init_list_comp.pass.cpp | 17 +++++++++++++++-- .../alg.sorting/alg.min.max/minmax_comp.pass.cpp | 8 ++++---- .../alg.sorting/alg.min.max/minmax_init_list.pass.cpp | 12 +++++++++--- .../alg.min.max/minmax_init_list_comp.pass.cpp | 13 ++++++++++--- 7 files changed, 81 insertions(+), 18 deletions(-) (limited to 'libcxx/test/algorithms/alg.sorting') diff --git a/libcxx/test/algorithms/alg.sorting/alg.min.max/max_init_list.pass.cpp b/libcxx/test/algorithms/alg.sorting/alg.min.max/max_init_list.pass.cpp index a5b61d63159..124ca61be9a 100644 --- a/libcxx/test/algorithms/alg.sorting/alg.min.max/max_init_list.pass.cpp +++ b/libcxx/test/algorithms/alg.sorting/alg.min.max/max_init_list.pass.cpp @@ -16,8 +16,20 @@ #include #include -#error max(initializer_list 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 } diff --git a/libcxx/test/algorithms/alg.sorting/alg.min.max/max_init_list_comp.pass.cpp b/libcxx/test/algorithms/alg.sorting/alg.min.max/max_init_list_comp.pass.cpp index 133e104583c..8c78fbdb6f1 100644 --- a/libcxx/test/algorithms/alg.sorting/alg.min.max/max_init_list_comp.pass.cpp +++ b/libcxx/test/algorithms/alg.sorting/alg.min.max/max_init_list_comp.pass.cpp @@ -14,10 +14,23 @@ // max(initializer_list t, Compare comp); #include +#include #include -#error max(initializer_list t, Compare comp) is not implemented - int main() { +#ifdef _LIBCPP_MOVE + int i = std::max({2, 3, 1}, std::greater()); + assert(i == 1); + i = std::max({2, 1, 3}, std::greater()); + assert(i == 1); + i = std::max({3, 1, 2}, std::greater()); + assert(i == 1); + i = std::max({3, 2, 1}, std::greater()); + assert(i == 1); + i = std::max({1, 2, 3}, std::greater()); + assert(i == 1); + i = std::max({1, 3, 2}, std::greater()); + assert(i == 1); +#endif } diff --git a/libcxx/test/algorithms/alg.sorting/alg.min.max/min_init_list.pass.cpp b/libcxx/test/algorithms/alg.sorting/alg.min.max/min_init_list.pass.cpp index 977f8b61a61..bb19d4fdf99 100644 --- a/libcxx/test/algorithms/alg.sorting/alg.min.max/min_init_list.pass.cpp +++ b/libcxx/test/algorithms/alg.sorting/alg.min.max/min_init_list.pass.cpp @@ -16,8 +16,20 @@ #include #include -#error min(initializer_list 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 } diff --git a/libcxx/test/algorithms/alg.sorting/alg.min.max/min_init_list_comp.pass.cpp b/libcxx/test/algorithms/alg.sorting/alg.min.max/min_init_list_comp.pass.cpp index 04bf2f9959b..161d68207c6 100644 --- a/libcxx/test/algorithms/alg.sorting/alg.min.max/min_init_list_comp.pass.cpp +++ b/libcxx/test/algorithms/alg.sorting/alg.min.max/min_init_list_comp.pass.cpp @@ -14,10 +14,23 @@ // min(initializer_list t, Compare comp); #include +#include #include -#error min(initializer_list t, Compare comp) is not implemented - int main() { +#ifdef _LIBCPP_MOVE + int i = std::min({2, 3, 1}, std::greater()); + assert(i == 3); + i = std::min({2, 1, 3}, std::greater()); + assert(i == 3); + i = std::min({3, 1, 2}, std::greater()); + assert(i == 3); + i = std::min({3, 2, 1}, std::greater()); + assert(i == 3); + i = std::min({1, 2, 3}, std::greater()); + assert(i == 3); + i = std::min({1, 3, 2}, std::greater()); + assert(i == 3); +#endif } diff --git a/libcxx/test/algorithms/alg.sorting/alg.min.max/minmax_comp.pass.cpp b/libcxx/test/algorithms/alg.sorting/alg.min.max/minmax_comp.pass.cpp index d35c3907ae0..83fa53c8f1c 100644 --- a/libcxx/test/algorithms/alg.sorting/alg.min.max/minmax_comp.pass.cpp +++ b/libcxx/test/algorithms/alg.sorting/alg.min.max/minmax_comp.pass.cpp @@ -38,13 +38,13 @@ int main() { int x = 0; int y = 1; - test(x, y, std::greater(), x, y); - test(y, x, std::greater(), x, y); + test(x, y, std::greater(), y, x); + test(y, x, std::greater(), y, x); } { int x = 1; int y = 0; - test(x, y, std::greater(), y, x); - test(y, x, std::greater(), y, x); + test(x, y, std::greater(), x, y); + test(y, x, std::greater(), x, y); } } diff --git a/libcxx/test/algorithms/alg.sorting/alg.min.max/minmax_init_list.pass.cpp b/libcxx/test/algorithms/alg.sorting/alg.min.max/minmax_init_list.pass.cpp index d10ee550b1b..0dbb2117228 100644 --- a/libcxx/test/algorithms/alg.sorting/alg.min.max/minmax_init_list.pass.cpp +++ b/libcxx/test/algorithms/alg.sorting/alg.min.max/minmax_init_list.pass.cpp @@ -10,14 +10,20 @@ // // template -// pair +// pair // minmax(initializer_list t); #include #include -#error minmax(initializer_list t) is not implemented - int main() { +#ifdef _LIBCPP_MOVE + assert((std::minmax({1, 2, 3}) == std::pair(1, 3))); + assert((std::minmax({1, 3, 2}) == std::pair(1, 3))); + assert((std::minmax({2, 1, 3}) == std::pair(1, 3))); + assert((std::minmax({2, 3, 1}) == std::pair(1, 3))); + assert((std::minmax({3, 1, 2}) == std::pair(1, 3))); + assert((std::minmax({3, 2, 1}) == std::pair(1, 3))); +#endif } diff --git a/libcxx/test/algorithms/alg.sorting/alg.min.max/minmax_init_list_comp.pass.cpp b/libcxx/test/algorithms/alg.sorting/alg.min.max/minmax_init_list_comp.pass.cpp index 5b47f1c6eba..4f3d1441402 100644 --- a/libcxx/test/algorithms/alg.sorting/alg.min.max/minmax_init_list_comp.pass.cpp +++ b/libcxx/test/algorithms/alg.sorting/alg.min.max/minmax_init_list_comp.pass.cpp @@ -10,14 +10,21 @@ // // template -// pair +// pair // minmax(initializer_list t, Compare comp); #include +#include #include -#error minmax(initializer_list t, Compare comp) is not implemented - int main() { +#ifdef _LIBCPP_MOVE + assert((std::minmax({1, 2, 3}, std::greater()) == std::pair(3, 1))); + assert((std::minmax({1, 3, 2}, std::greater()) == std::pair(3, 1))); + assert((std::minmax({2, 1, 3}, std::greater()) == std::pair(3, 1))); + assert((std::minmax({2, 3, 1}, std::greater()) == std::pair(3, 1))); + assert((std::minmax({3, 1, 2}, std::greater()) == std::pair(3, 1))); + assert((std::minmax({3, 2, 1}, std::greater()) == std::pair(3, 1))); +#endif } -- cgit v1.2.3