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& c, const allocator_type& a);
125a83710eSEric Fiselier 
135a83710eSEric Fiselier #include <deque>
145a83710eSEric Fiselier #include <cassert>
155a83710eSEric Fiselier 
16*7fc6a556SMarshall Clow #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,const typename C::allocator_type & a)225a83710eSEric Fiselier test(const C& x, const typename C::allocator_type& a)
235a83710eSEric Fiselier {
245a83710eSEric Fiselier     C c(x, a);
255a83710eSEric Fiselier     assert(c == x);
265a83710eSEric Fiselier     assert(c.get_allocator() == a);
275a83710eSEric Fiselier }
285a83710eSEric Fiselier 
main(int,char **)292df59c50SJF Bastien int main(int, char**)
305a83710eSEric Fiselier {
315a83710eSEric Fiselier     {
325a83710eSEric Fiselier         int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
335a83710eSEric Fiselier         int* an = ab + sizeof(ab)/sizeof(ab[0]);
345a83710eSEric Fiselier         test(std::deque<int, test_allocator<int> >(ab, an, test_allocator<int>(3)),
355a83710eSEric Fiselier                                                            test_allocator<int>(4));
365a83710eSEric Fiselier     }
375a83710eSEric Fiselier     {
385a83710eSEric Fiselier         int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
395a83710eSEric Fiselier         int* an = ab + sizeof(ab)/sizeof(ab[0]);
405a83710eSEric Fiselier         test(std::deque<int, other_allocator<int> >(ab, an, other_allocator<int>(3)),
415a83710eSEric Fiselier                                                             other_allocator<int>(4));
425a83710eSEric Fiselier     }
43f2f2a639SEric Fiselier #if TEST_STD_VER >= 11
445a83710eSEric Fiselier     {
455a83710eSEric Fiselier         int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
465a83710eSEric Fiselier         int* an = ab + sizeof(ab)/sizeof(ab[0]);
475a83710eSEric Fiselier         test(std::deque<int, min_allocator<int> >(ab, an, min_allocator<int>()),
485a83710eSEric Fiselier                                                           min_allocator<int>());
495a83710eSEric Fiselier     }
505a83710eSEric Fiselier #endif
512df59c50SJF Bastien 
522df59c50SJF Bastien   return 0;
535a83710eSEric Fiselier }
54