1 //===----------------------------------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
12 // explicit vector(size_type n);
17 #include "DefaultOnly.h"
18 #include "min_allocator.h"
19 #include "test_allocator.h"
20 #include "asan_testing.h"
24 test2(typename C::size_type n, typename C::allocator_type const& a = typename C::allocator_type ())
26 #if _LIBCPP_STD_VER > 11
28 assert(c.__invariants());
29 assert(c.size() == n);
30 assert(c.get_allocator() == a);
31 assert(is_contiguous_container_asan_correct(c));
32 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
33 for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i)
34 assert(*i == typename C::value_type());
35 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
41 test1(typename C::size_type n)
44 assert(c.__invariants());
45 assert(c.size() == n);
46 assert(c.get_allocator() == typename C::allocator_type());
47 assert(is_contiguous_container_asan_correct(c));
48 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
49 for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i)
50 assert(*i == typename C::value_type());
51 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
56 test(typename C::size_type n)
64 test<std::vector<int> >(50);
65 test<std::vector<DefaultOnly> >(500);
66 assert(DefaultOnly::count == 0);
67 #if __cplusplus >= 201103L
68 test<std::vector<int, min_allocator<int>> >(50);
69 test<std::vector<DefaultOnly, min_allocator<DefaultOnly>> >(500);
70 test2<std::vector<DefaultOnly, test_allocator<DefaultOnly>> >( 100, test_allocator<DefaultOnly>(23));
71 assert(DefaultOnly::count == 0);