Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / third_party / libc++ / trunk / test / containers / sequences / vector / vector.cons / initializer_list_alloc.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 // vector(initializer_list<value_type> il, const Allocator& a = allocator_type());
13
14 #include <vector>
15 #include <cassert>
16
17 #include "test_allocator.h"
18 #include "min_allocator.h"
19 #include "asan_testing.h"
20
21 int main()
22 {
23 #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
24     {
25     std::vector<int, test_allocator<int>> d({3, 4, 5, 6}, test_allocator<int>(3));
26     assert(d.get_allocator() == test_allocator<int>(3));
27     assert(d.size() == 4);
28     assert(is_contiguous_container_asan_correct(d)); 
29     assert(d[0] == 3);
30     assert(d[1] == 4);
31     assert(d[2] == 5);
32     assert(d[3] == 6);
33     }
34 #if __cplusplus >= 201103L
35     {
36     std::vector<int, min_allocator<int>> d({3, 4, 5, 6}, min_allocator<int>());
37     assert(d.get_allocator() == min_allocator<int>());
38     assert(d.size() == 4);
39     assert(is_contiguous_container_asan_correct(d)); 
40     assert(d[0] == 3);
41     assert(d[1] == 4);
42     assert(d[2] == 5);
43     assert(d[3] == 6);
44     }
45 #endif
46 #endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
47 }