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 // <deque>
10 
11 // deque& operator=(const deque& c);
12 
13 #include <deque>
14 #include <cassert>
15 #include "test_allocator.h"
16 #include "min_allocator.h"
17 
18 template <class C>
19 void
20 test(const C& x)
21 {
22     C c;
23     c = x;
24     assert(c == x);
25 }
26 
27 int main(int, char**)
28 {
29     {
30         int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
31         int* an = ab + sizeof(ab)/sizeof(ab[0]);
32         test(std::deque<int>(ab, an));
33     }
34     {
35         std::deque<int, test_allocator<int> > l(3, 2, test_allocator<int>(5));
36         std::deque<int, test_allocator<int> > l2(l, test_allocator<int>(3));
37         l2 = l;
38         assert(l2 == l);
39         assert(l2.get_allocator() == test_allocator<int>(3));
40     }
41     {
42         std::deque<int, other_allocator<int> > l(3, 2, other_allocator<int>(5));
43         std::deque<int, other_allocator<int> > l2(l, other_allocator<int>(3));
44         l2 = l;
45         assert(l2 == l);
46         assert(l2.get_allocator() == other_allocator<int>(5));
47     }
48 #if TEST_STD_VER >= 11
49     {
50         int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
51         int* an = ab + sizeof(ab)/sizeof(ab[0]);
52         test(std::deque<int, min_allocator<int>>(ab, an));
53     }
54     {
55         std::deque<int, min_allocator<int> > l(3, 2, min_allocator<int>());
56         std::deque<int, min_allocator<int> > l2(l, min_allocator<int>());
57         l2 = l;
58         assert(l2 == l);
59         assert(l2.get_allocator() == min_allocator<int>());
60     }
61 #endif
62 
63   return 0;
64 }
65