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// void assign(initializer_list<value_type> il);
14
15#include <vector>
16#include <cassert>
17
18#include "test_macros.h"
19#include "min_allocator.h"
20
21TEST_CONSTEXPR_CXX20 bool tests()
22{
23 {
24 std::vector<bool> d;
25 d.assign(l: {true, false, false, true});
26 assert(d.size() == 4);
27 assert(d[0] == true);
28 assert(d[1] == false);
29 assert(d[2] == false);
30 assert(d[3] == true);
31 }
32 {
33 std::vector<bool, min_allocator<bool>> d;
34 d.assign({true, false, false, true});
35 assert(d.size() == 4);
36 assert(d[0] == true);
37 assert(d[1] == false);
38 assert(d[2] == false);
39 assert(d[3] == true);
40 }
41
42 return true;
43}
44
45int main(int, char**)
46{
47 tests();
48#if TEST_STD_VER > 17
49 static_assert(tests());
50#endif
51 return 0;
52}
53

source code of libcxx/test/std/containers/sequences/vector.bool/assign_initializer_list.pass.cpp