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 | // <deque> |
12 | |
13 | // iterator insert(const_iterator p, initializer_list<value_type> il); |
14 | |
15 | #include "asan_testing.h" |
16 | #include <deque> |
17 | #include <cassert> |
18 | |
19 | #include "test_macros.h" |
20 | #include "min_allocator.h" |
21 | |
22 | int main(int, char**) |
23 | { |
24 | { |
25 | std::deque<int> d(10, 1); |
26 | std::deque<int>::iterator i = d.insert(p: d.cbegin() + 2, l: {3, 4, 5, 6}); |
27 | assert(d.size() == 14); |
28 | assert(i == d.begin() + 2); |
29 | assert(d[0] == 1); |
30 | assert(d[1] == 1); |
31 | assert(d[2] == 3); |
32 | assert(d[3] == 4); |
33 | assert(d[4] == 5); |
34 | assert(d[5] == 6); |
35 | assert(d[6] == 1); |
36 | assert(d[7] == 1); |
37 | assert(d[8] == 1); |
38 | assert(d[9] == 1); |
39 | assert(d[10] == 1); |
40 | assert(d[11] == 1); |
41 | assert(d[12] == 1); |
42 | assert(d[13] == 1); |
43 | LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(d)); |
44 | } |
45 | { |
46 | std::deque<int, min_allocator<int>> d(10, 1); |
47 | std::deque<int, min_allocator<int>>::iterator i = d.insert(d.cbegin() + 2, {3, 4, 5, 6}); |
48 | assert(d.size() == 14); |
49 | assert(i == d.begin() + 2); |
50 | assert(d[0] == 1); |
51 | assert(d[1] == 1); |
52 | assert(d[2] == 3); |
53 | assert(d[3] == 4); |
54 | assert(d[4] == 5); |
55 | assert(d[5] == 6); |
56 | assert(d[6] == 1); |
57 | assert(d[7] == 1); |
58 | assert(d[8] == 1); |
59 | assert(d[9] == 1); |
60 | assert(d[10] == 1); |
61 | assert(d[11] == 1); |
62 | assert(d[12] == 1); |
63 | assert(d[13] == 1); |
64 | LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(d)); |
65 | } |
66 | |
67 | return 0; |
68 | } |
69 | |