[PowerPC] Collect some CallLowering arguments into a struct. [NFC]
[llvm-project.git] / libcxx / test / std / containers / sequences / vector / vector.cons / copy.pass.cpp
blob844da38416b0f8495bbf6d7864de7396a8d90844
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 //===----------------------------------------------------------------------===//
9 // <vector>
11 // vector(const vector& v);
13 #include <vector>
14 #include <cassert>
16 #include "test_macros.h"
17 #include "test_allocator.h"
18 #include "min_allocator.h"
19 #include "asan_testing.h"
21 template <class C>
22 void
23 test(const C& x)
25 typename C::size_type s = x.size();
26 C c(x);
27 LIBCPP_ASSERT(c.__invariants());
28 assert(c.size() == s);
29 assert(c == x);
30 LIBCPP_ASSERT(is_contiguous_container_asan_correct(c));
33 int main(int, char**)
36 int a[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 1, 0};
37 int* an = a + sizeof(a)/sizeof(a[0]);
38 test(std::vector<int>(a, an));
41 std::vector<int, test_allocator<int> > v(3, 2, test_allocator<int>(5));
42 std::vector<int, test_allocator<int> > v2 = v;
43 assert(is_contiguous_container_asan_correct(v));
44 assert(is_contiguous_container_asan_correct(v2));
45 assert(v2 == v);
46 assert(v2.get_allocator() == v.get_allocator());
47 assert(is_contiguous_container_asan_correct(v));
48 assert(is_contiguous_container_asan_correct(v2));
50 #if TEST_STD_VER >= 11
52 std::vector<int, other_allocator<int> > v(3, 2, other_allocator<int>(5));
53 std::vector<int, other_allocator<int> > v2 = v;
54 assert(is_contiguous_container_asan_correct(v));
55 assert(is_contiguous_container_asan_correct(v2));
56 assert(v2 == v);
57 assert(v2.get_allocator() == other_allocator<int>(-2));
58 assert(is_contiguous_container_asan_correct(v));
59 assert(is_contiguous_container_asan_correct(v2));
62 int a[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 1, 0};
63 int* an = a + sizeof(a)/sizeof(a[0]);
64 test(std::vector<int, min_allocator<int>>(a, an));
67 std::vector<int, min_allocator<int> > v(3, 2, min_allocator<int>());
68 std::vector<int, min_allocator<int> > v2 = v;
69 assert(is_contiguous_container_asan_correct(v));
70 assert(is_contiguous_container_asan_correct(v2));
71 assert(v2 == v);
72 assert(v2.get_allocator() == v.get_allocator());
73 assert(is_contiguous_container_asan_correct(v));
74 assert(is_contiguous_container_asan_correct(v2));
76 #endif
78 return 0;