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 | #include "test_macros.h" |
18 | #include "min_allocator.h" |
19 | #include "asan_testing.h" |
20 | |
21 | TEST_CONSTEXPR_CXX20 bool tests() |
22 | { |
23 | { |
24 | std::vector<int> d = {3, 4, 5, 6}; |
25 | assert(d.size() == 4); |
26 | assert(is_contiguous_container_asan_correct(d)); |
27 | assert(d[0] == 3); |
28 | assert(d[1] == 4); |
29 | assert(d[2] == 5); |
30 | assert(d[3] == 6); |
31 | } |
32 | { |
33 | std::vector<int, min_allocator<int>> d = {3, 4, 5, 6}; |
34 | assert(d.size() == 4); |
35 | assert(is_contiguous_container_asan_correct(d)); |
36 | assert(d[0] == 3); |
37 | assert(d[1] == 4); |
38 | assert(d[2] == 5); |
39 | assert(d[3] == 6); |
40 | } |
41 | { |
42 | std::vector<int, safe_allocator<int>> d = {3, 4, 5, 6}; |
43 | assert(d.size() == 4); |
44 | assert(is_contiguous_container_asan_correct(d)); |
45 | assert(d[0] == 3); |
46 | assert(d[1] == 4); |
47 | assert(d[2] == 5); |
48 | assert(d[3] == 6); |
49 | } |
50 | |
51 | return true; |
52 | } |
53 | |
54 | int main(int, char**) |
55 | { |
56 | tests(); |
57 | #if TEST_STD_VER > 17 |
58 | static_assert(tests()); |
59 | #endif |
60 | return 0; |
61 | } |
62 | |