[PowerPC][NFC] Cleanup PPCCTRLoopsVerify pass
[llvm-project.git] / libcxx / test / std / containers / sequences / vector.bool / resize_size.pass.cpp
blobc9d7f3dbb9ee49ac2f055bdd1c615e63c14995c6
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 int main(int, char**)
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, min_allocator<bool>> v(100);
38 v.resize(50);
39 assert(v.size() == 50);
40 assert(v.capacity() >= 100);
41 v.resize(200);
42 assert(v.size() == 200);
43 assert(v.capacity() >= 200);
44 v.reserve(400);
45 v.resize(300); // check the case when resizing and we already have room
46 assert(v.size() == 300);
47 assert(v.capacity() >= 400);
49 #endif
51 return 0;