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>
13//   pair<T, T>
14//   minmax(initializer_list<T> t);
15
16#include <algorithm>
17#include <cassert>
18
19int main()
20{
21#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
22    assert((std::minmax({1, 2, 3}) == std::pair<int, int>(1, 3)));
23    assert((std::minmax({1, 3, 2}) == std::pair<int, int>(1, 3)));
24    assert((std::minmax({2, 1, 3}) == std::pair<int, int>(1, 3)));
25    assert((std::minmax({2, 3, 1}) == std::pair<int, int>(1, 3)));
26    assert((std::minmax({3, 1, 2}) == std::pair<int, int>(1, 3)));
27    assert((std::minmax({3, 2, 1}) == std::pair<int, int>(1, 3)));
28#if _LIBCPP_STD_VER > 11
29    {
30    static_assert((std::minmax({1, 2, 3}) == std::pair<int, int>(1, 3)), "");
31    static_assert((std::minmax({1, 3, 2}) == std::pair<int, int>(1, 3)), "");
32    static_assert((std::minmax({2, 1, 3}) == std::pair<int, int>(1, 3)), "");
33    static_assert((std::minmax({2, 3, 1}) == std::pair<int, int>(1, 3)), "");
34    static_assert((std::minmax({3, 1, 2}) == std::pair<int, int>(1, 3)), "");
35    static_assert((std::minmax({3, 2, 1}) == std::pair<int, int>(1, 3)), "");
36    }
37#endif
38#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
39}
40