Home | History | Annotate | Download | only in list.cons
      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 // list(const list& c);
     13 
     14 #include <list>
     15 #include <cassert>
     16 
     17 #include "test_macros.h"
     18 #include "DefaultOnly.h"
     19 #include "test_allocator.h"
     20 #include "min_allocator.h"
     21 
     22 int main()
     23 {
     24     {
     25         std::list<int> l(3, 2);
     26         std::list<int> l2 = l;
     27         assert(l2 == l);
     28     }
     29     {
     30         std::list<int, test_allocator<int> > l(3, 2, test_allocator<int>(5));
     31         std::list<int, test_allocator<int> > l2 = l;
     32         assert(l2 == l);
     33         assert(l2.get_allocator() == l.get_allocator());
     34     }
     35 #if TEST_STD_VER >= 11
     36     {
     37         std::list<int, other_allocator<int> > l(3, 2, other_allocator<int>(5));
     38         std::list<int, other_allocator<int> > l2 = l;
     39         assert(l2 == l);
     40         assert(l2.get_allocator() == other_allocator<int>(-2));
     41     }
     42     {
     43         std::list<int, min_allocator<int>> l(3, 2);
     44         std::list<int, min_allocator<int>> l2 = l;
     45         assert(l2 == l);
     46     }
     47     {
     48         std::list<int, min_allocator<int> > l(3, 2, min_allocator<int>());
     49         std::list<int, min_allocator<int> > l2 = l;
     50         assert(l2 == l);
     51         assert(l2.get_allocator() == l.get_allocator());
     52     }
     53 #endif
     54 }
     55