Home | History | Annotate | Download | only in vector.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 // <vector>
     11 
     12 // vector(size_type n, const value_type& x, const allocator_type& a);
     13 
     14 #include <vector>
     15 #include <cassert>
     16 
     17 #include "test_macros.h"
     18 #include "min_allocator.h"
     19 #include "asan_testing.h"
     20 
     21 template <class C>
     22 void
     23 test(typename C::size_type n, const typename C::value_type& x,
     24      const typename C::allocator_type& a)
     25 {
     26     C c(n, x, a);
     27     LIBCPP_ASSERT(c.__invariants());
     28     assert(a == c.get_allocator());
     29     assert(c.size() == n);
     30     LIBCPP_ASSERT(is_contiguous_container_asan_correct(c));
     31     for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i)
     32         assert(*i == x);
     33 }
     34 
     35 int main()
     36 {
     37     test<std::vector<int> >(50, 3, std::allocator<int>());
     38 #if TEST_STD_VER >= 11
     39     test<std::vector<int, min_allocator<int>> >(50, 3, min_allocator<int>());
     40 #endif
     41 }
     42