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& operator=(const deque& c);
125a83710eSEric Fiselier
135a83710eSEric Fiselier #include <deque>
145a83710eSEric Fiselier #include <cassert>
15*7fc6a556SMarshall Clow #include "test_macros.h"
165a83710eSEric Fiselier #include "test_allocator.h"
175a83710eSEric Fiselier #include "min_allocator.h"
185a83710eSEric Fiselier
195a83710eSEric Fiselier template <class C>
205a83710eSEric Fiselier void
test(const C & x)215a83710eSEric Fiselier test(const C& x)
225a83710eSEric Fiselier {
235a83710eSEric Fiselier C c;
245a83710eSEric Fiselier c = x;
255a83710eSEric Fiselier assert(c == x);
265a83710eSEric Fiselier }
275a83710eSEric Fiselier
main(int,char **)282df59c50SJF 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> > l(3, 2, test_allocator<int>(5));
375a83710eSEric Fiselier std::deque<int, test_allocator<int> > l2(l, test_allocator<int>(3));
385a83710eSEric Fiselier l2 = l;
395a83710eSEric Fiselier assert(l2 == l);
405a83710eSEric Fiselier assert(l2.get_allocator() == test_allocator<int>(3));
415a83710eSEric Fiselier }
425a83710eSEric Fiselier {
435a83710eSEric Fiselier std::deque<int, other_allocator<int> > l(3, 2, other_allocator<int>(5));
445a83710eSEric Fiselier std::deque<int, other_allocator<int> > l2(l, other_allocator<int>(3));
455a83710eSEric Fiselier l2 = l;
465a83710eSEric Fiselier assert(l2 == l);
475a83710eSEric Fiselier assert(l2.get_allocator() == other_allocator<int>(5));
485a83710eSEric Fiselier }
49f2f2a639SEric Fiselier #if TEST_STD_VER >= 11
505a83710eSEric Fiselier {
515a83710eSEric Fiselier int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
525a83710eSEric Fiselier int* an = ab + sizeof(ab)/sizeof(ab[0]);
535a83710eSEric Fiselier test(std::deque<int, min_allocator<int>>(ab, an));
545a83710eSEric Fiselier }
555a83710eSEric Fiselier {
565a83710eSEric Fiselier std::deque<int, min_allocator<int> > l(3, 2, min_allocator<int>());
575a83710eSEric Fiselier std::deque<int, min_allocator<int> > l2(l, min_allocator<int>());
585a83710eSEric Fiselier l2 = l;
595a83710eSEric Fiselier assert(l2 == l);
605a83710eSEric Fiselier assert(l2.get_allocator() == min_allocator<int>());
615a83710eSEric Fiselier }
625a83710eSEric Fiselier #endif
632df59c50SJF Bastien
642df59c50SJF Bastien return 0;
655a83710eSEric Fiselier }
66