15a83710eSEric Fiselier //===----------------------------------------------------------------------===//
25a83710eSEric Fiselier //
357b08b09SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
457b08b09SChandler Carruth // See https://llvm.org/LICENSE.txt for license information.
557b08b09SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
65a83710eSEric Fiselier //
75a83710eSEric Fiselier //===----------------------------------------------------------------------===//
85a83710eSEric Fiselier 
95a83710eSEric Fiselier // <deque>
105a83710eSEric Fiselier 
115a83710eSEric Fiselier // deque(const deque&);
125a83710eSEric Fiselier 
135a83710eSEric Fiselier #include <deque>
145a83710eSEric Fiselier #include <cassert>
1554613ab4SEric Fiselier 
1654613ab4SEric Fiselier #include "test_macros.h"
175a83710eSEric Fiselier #include "test_allocator.h"
185a83710eSEric Fiselier #include "min_allocator.h"
195a83710eSEric Fiselier 
205a83710eSEric Fiselier template <class C>
215a83710eSEric Fiselier void
test(const C & x)225a83710eSEric Fiselier test(const C& x)
235a83710eSEric Fiselier {
245a83710eSEric Fiselier     C c(x);
255a83710eSEric Fiselier     assert(c == x);
265a83710eSEric Fiselier }
275a83710eSEric Fiselier 
main(int,char **)28*2df59c50SJF Bastien int main(int, char**)
295a83710eSEric Fiselier {
305a83710eSEric Fiselier     {
315a83710eSEric Fiselier         int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
325a83710eSEric Fiselier         int* an = ab + sizeof(ab)/sizeof(ab[0]);
335a83710eSEric Fiselier         test(std::deque<int>(ab, an));
345a83710eSEric Fiselier     }
355a83710eSEric Fiselier     {
365a83710eSEric Fiselier         std::deque<int, test_allocator<int> > v(3, 2, test_allocator<int>(5));
375a83710eSEric Fiselier         std::deque<int, test_allocator<int> > v2 = v;
385a83710eSEric Fiselier         assert(v2 == v);
395a83710eSEric Fiselier         assert(v2.get_allocator() == v.get_allocator());
405a83710eSEric Fiselier     }
4154613ab4SEric Fiselier #if TEST_STD_VER >= 11
425a83710eSEric Fiselier     {
435a83710eSEric Fiselier         std::deque<int, other_allocator<int> > v(3, 2, other_allocator<int>(5));
445a83710eSEric Fiselier         std::deque<int, other_allocator<int> > v2 = v;
455a83710eSEric Fiselier         assert(v2 == v);
465a83710eSEric Fiselier         assert(v2.get_allocator() == other_allocator<int>(-2));
475a83710eSEric Fiselier     }
485a83710eSEric Fiselier     {
495a83710eSEric Fiselier         int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
505a83710eSEric Fiselier         int* an = ab + sizeof(ab)/sizeof(ab[0]);
515a83710eSEric Fiselier         test(std::deque<int, min_allocator<int>>(ab, an));
525a83710eSEric Fiselier     }
535a83710eSEric Fiselier     {
545a83710eSEric Fiselier         std::deque<int, min_allocator<int> > v(3, 2, min_allocator<int>());
555a83710eSEric Fiselier         std::deque<int, min_allocator<int> > v2 = v;
565a83710eSEric Fiselier         assert(v2 == v);
575a83710eSEric Fiselier         assert(v2.get_allocator() == v.get_allocator());
585a83710eSEric Fiselier     }
595a83710eSEric Fiselier #endif
60*2df59c50SJF Bastien 
61*2df59c50SJF Bastien   return 0;
625a83710eSEric Fiselier }
63