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

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