]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/std/algorithms/alg.sorting/alg.min.max/min_init_list.pass.cpp
Vendor import of libc++ trunk r290819:
[FreeBSD/FreeBSD.git] / test / std / algorithms / alg.sorting / alg.min.max / min_init_list.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 // UNSUPPORTED: c++98, c++03
11
12 // <algorithm>
13
14 // template<class T>
15 //   T
16 //   min(initializer_list<T> t);
17
18 #include <algorithm>
19 #include <cassert>
20
21 #include "test_macros.h"
22
23 int main()
24 {
25     int i = std::min({2, 3, 1});
26     assert(i == 1);
27     i = std::min({2, 1, 3});
28     assert(i == 1);
29     i = std::min({3, 1, 2});
30     assert(i == 1);
31     i = std::min({3, 2, 1});
32     assert(i == 1);
33     i = std::min({1, 2, 3});
34     assert(i == 1);
35     i = std::min({1, 3, 2});
36     assert(i == 1);
37 #if TEST_STD_VER >= 14
38     {
39     static_assert(std::min({1, 3, 2}) == 1, "");
40     static_assert(std::min({2, 1, 3}) == 1, "");
41     static_assert(std::min({3, 2, 1}) == 1, "");
42     }
43 #endif
44 }