]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/libcxx/containers/sequences/list/list.special/db_swap_2.pass.cpp
Vendor import of libc++ release_39 branch r276489:
[FreeBSD/FreeBSD.git] / test / libcxx / containers / sequences / list / list.special / db_swap_2.pass.cpp
1 //===----------------------------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 // <list>
11
12 // template <class T, class Alloc>
13 //   void swap(list<T,Alloc>& x, list<T,Alloc>& y);
14
15
16 #define _LIBCPP_DEBUG 1
17 #define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
18
19 #include <list>
20 #include <cassert>
21 #include "test_allocator.h"
22 #include "min_allocator.h"
23
24 int main()
25 {
26     // allocators do not compare equal
27     {
28         int a1[] = {1, 3, 7, 9, 10};
29         int a2[] = {0, 2, 4, 5, 6, 8, 11};
30         typedef test_allocator<int> A;
31         std::list<int, A> c1(a1, a1+sizeof(a1)/sizeof(a1[0]), A(1));
32         std::list<int, A> c2(a2, a2+sizeof(a2)/sizeof(a2[0]), A(2));
33         swap(c1, c2);
34         assert(false);
35     }
36 }