Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / third_party / libc++ / trunk / test / containers / sequences / vector / vector.modifiers / insert_iter_initializer_list.pass.cpp
1 //===----------------------------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 // <vector>
11
12 // iterator insert(const_iterator p, initializer_list<value_type> il);
13
14 #include <vector>
15 #include <cassert>
16
17 #include "min_allocator.h"
18 #include "asan_testing.h"
19
20 int main()
21 {
22 #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
23     {
24     std::vector<int> d(10, 1);
25     std::vector<int>::iterator i = d.insert(d.cbegin() + 2, {3, 4, 5, 6});
26     assert(d.size() == 14);
27     assert(is_contiguous_container_asan_correct(d)); 
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     }
44 #if __cplusplus >= 201103L
45     {
46     std::vector<int, min_allocator<int>> d(10, 1);
47     std::vector<int, min_allocator<int>>::iterator i = d.insert(d.cbegin() + 2, {3, 4, 5, 6});
48     assert(d.size() == 14);
49     assert(is_contiguous_container_asan_correct(d)); 
50     assert(i == d.begin() + 2);
51     assert(d[0] == 1);
52     assert(d[1] == 1);
53     assert(d[2] == 3);
54     assert(d[3] == 4);
55     assert(d[4] == 5);
56     assert(d[5] == 6);
57     assert(d[6] == 1);
58     assert(d[7] == 1);
59     assert(d[8] == 1);
60     assert(d[9] == 1);
61     assert(d[10] == 1);
62     assert(d[11] == 1);
63     assert(d[12] == 1);
64     assert(d[13] == 1);
65     }
66 #endif
67 #endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
68 }