1 //===----------------------------------------------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
12 // explicit vector(size_type n);
17 #include "test_macros.h"
18 #include "min_allocator.h"
19 #include "test_allocator.h"
22 TEST_CONSTEXPR_CXX20
void test2(typename
C::size_type n
,
23 typename
C::allocator_type
const& a
= typename
C::allocator_type ())
25 #if TEST_STD_VER >= 14
27 LIBCPP_ASSERT(c
.__invariants());
28 assert(c
.size() == n
);
29 assert(c
.get_allocator() == a
);
30 for (typename
C::const_iterator i
= c
.cbegin(), e
= c
.cend(); i
!= e
; ++i
)
31 assert(*i
== typename
C::value_type());
39 TEST_CONSTEXPR_CXX20
void test1(typename
C::size_type n
)
42 LIBCPP_ASSERT(c
.__invariants());
43 assert(c
.size() == n
);
44 assert(c
.get_allocator() == typename
C::allocator_type());
45 for (typename
C::const_iterator i
= c
.cbegin(), e
= c
.cend(); i
!= e
; ++i
)
46 assert(*i
== typename
C::value_type());
50 TEST_CONSTEXPR_CXX20
void test(typename
C::size_type n
)
56 TEST_CONSTEXPR_CXX20
bool tests()
58 test
<std::vector
<bool> >(50);
59 #if TEST_STD_VER >= 11
60 test
<std::vector
<bool, min_allocator
<bool>> >(50);
61 test2
<std::vector
<bool, test_allocator
<bool>> >( 100, test_allocator
<bool>(23));
71 static_assert(tests());