9288ccc9f127cd036064481d2d1bbd1d9c9da0e9
[platform/framework/web/crosswalk.git] / src / third_party / libc++ / trunk / test / algorithms / alg.sorting / alg.min.max / minmax_init_list_comp.pass.cpp
1 //===----------------------------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 // <algorithm>
11
12 // template<class T, class Compare>
13 //   pair<T, T>
14 //   minmax(initializer_list<T> t, Compare comp);
15
16 #include <algorithm>
17 #include <functional>
18 #include <cassert>
19
20 int main()
21 {
22 #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
23     assert((std::minmax({1, 2, 3}, std::greater<int>()) == std::pair<int, int>(3, 1)));
24     assert((std::minmax({1, 3, 2}, std::greater<int>()) == std::pair<int, int>(3, 1)));
25     assert((std::minmax({2, 1, 3}, std::greater<int>()) == std::pair<int, int>(3, 1)));
26     assert((std::minmax({2, 3, 1}, std::greater<int>()) == std::pair<int, int>(3, 1)));
27     assert((std::minmax({3, 1, 2}, std::greater<int>()) == std::pair<int, int>(3, 1)));
28     assert((std::minmax({3, 2, 1}, std::greater<int>()) == std::pair<int, int>(3, 1)));
29 #endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
30 }