xref: /llvm-project/libcxx/test/std/containers/sequences/vector.bool/initializer_list.pass.cpp (revision 98d3d5b5da66e3cf7807c23a0294280bb796466b)
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 // UNSUPPORTED: c++03
10 
11 // <vector>
12 
13 // vector(initializer_list<value_type> il);
14 
15 #include <vector>
16 #include <cassert>
17 
18 #include "test_macros.h"
19 #include "min_allocator.h"
20 
tests()21 TEST_CONSTEXPR_CXX20 bool tests()
22 {
23     {
24     std::vector<bool> d = {true, false, false, true};
25     assert(d.size() == 4);
26     assert(d[0] == true);
27     assert(d[1] == false);
28     assert(d[2] == false);
29     assert(d[3] == true);
30     }
31     {
32     std::vector<bool, min_allocator<bool>> d = {true, false, false, true};
33     assert(d.size() == 4);
34     assert(d[0] == true);
35     assert(d[1] == false);
36     assert(d[2] == false);
37     assert(d[3] == true);
38     }
39 
40     return true;
41 }
42 
main(int,char **)43 int main(int, char**)
44 {
45     tests();
46 #if TEST_STD_VER > 17
47     static_assert(tests());
48 #endif
49     return 0;
50 }
51