[RISCV] Fix mgather -> riscv.masked.strided.load combine not extending indices (...
[llvm-project.git] / libcxx / test / std / containers / sequences / vector.bool / construct_size.pass.cpp
blobbcc5a16859d3613147873cb041c4cc199fd4b9df
1 //===----------------------------------------------------------------------===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
9 // <vector>
10 // vector<bool>
12 // explicit vector(size_type n);
14 #include <vector>
15 #include <cassert>
17 #include "test_macros.h"
18 #include "min_allocator.h"
19 #include "test_allocator.h"
21 template <class C>
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
26 C c(n, a);
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());
32 #else
33 ((void)n);
34 ((void)a);
35 #endif
38 template <class C>
39 TEST_CONSTEXPR_CXX20 void test1(typename C::size_type n)
41 C c(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());
49 template <class C>
50 TEST_CONSTEXPR_CXX20 void test(typename C::size_type n)
52 test1<C> ( n );
53 test2<C> ( 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));
62 #endif
64 return true;
67 int main(int, char**)
69 tests();
70 #if TEST_STD_VER > 17
71 static_assert(tests());
72 #endif
73 return 0;