[flang][cuda] Do not apply implicit data attribute on dummy arg with VALUE (#119927)
[llvm-project.git] / libcxx / test / std / containers / sequences / vector.bool / resize_size.pass.cpp
blobef83dbf0a9741bce0624a97fa65adf47f9ababf6
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 // void resize(size_type sz);
14 #include <vector>
15 #include <cassert>
17 #include "test_macros.h"
18 #include "min_allocator.h"
20 TEST_CONSTEXPR_CXX20 bool tests()
23 std::vector<bool> v(100);
24 v.resize(50);
25 assert(v.size() == 50);
26 assert(v.capacity() >= 100);
27 v.resize(200);
28 assert(v.size() == 200);
29 assert(v.capacity() >= 200);
30 v.reserve(400);
31 v.resize(300); // check the case when resizing and we already have room
32 assert(v.size() == 300);
33 assert(v.capacity() >= 400);
35 #if TEST_STD_VER >= 11
37 std::vector<bool, explicit_allocator<bool>> v;
38 v.resize(10);
39 assert(v.size() == 10);
40 assert(v.capacity() >= 10);
43 std::vector<bool, min_allocator<bool>> v(100);
44 v.resize(50);
45 assert(v.size() == 50);
46 assert(v.capacity() >= 100);
47 v.resize(200);
48 assert(v.size() == 200);
49 assert(v.capacity() >= 200);
50 v.reserve(400);
51 v.resize(300); // check the case when resizing and we already have room
52 assert(v.size() == 300);
53 assert(v.capacity() >= 400);
55 #endif
57 return true;
60 int main(int, char**)
62 tests();
63 #if TEST_STD_VER > 17
64 static_assert(tests());
65 #endif
66 return 0;