[PowerPC][NFC] Cleanup PPCCTRLoopsVerify pass
[llvm-project.git] / libcxx / test / std / containers / sequences / deque / deque.cons / copy.pass.cpp
blob2d42ee38a50899c2ba5236eaa84e5b65c9d016a0
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 // <deque>
11 // deque(const deque&);
13 #include <deque>
14 #include <cassert>
16 #include "test_macros.h"
17 #include "test_allocator.h"
18 #include "min_allocator.h"
20 template <class C>
21 void
22 test(const C& x)
24 C c(x);
25 assert(c == x);
28 int main(int, char**)
31 int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
32 int* an = ab + sizeof(ab)/sizeof(ab[0]);
33 test(std::deque<int>(ab, an));
36 std::deque<int, test_allocator<int> > v(3, 2, test_allocator<int>(5));
37 std::deque<int, test_allocator<int> > v2 = v;
38 assert(v2 == v);
39 assert(v2.get_allocator() == v.get_allocator());
41 #if TEST_STD_VER >= 11
43 std::deque<int, other_allocator<int> > v(3, 2, other_allocator<int>(5));
44 std::deque<int, other_allocator<int> > v2 = v;
45 assert(v2 == v);
46 assert(v2.get_allocator() == other_allocator<int>(-2));
49 int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
50 int* an = ab + sizeof(ab)/sizeof(ab[0]);
51 test(std::deque<int, min_allocator<int>>(ab, an));
54 std::deque<int, min_allocator<int> > v(3, 2, min_allocator<int>());
55 std::deque<int, min_allocator<int> > v2 = v;
56 assert(v2 == v);
57 assert(v2.get_allocator() == v.get_allocator());
59 #endif
61 return 0;