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 //===----------------------------------------------------------------------===//
8 
9 // <vector>
10 // vector<bool>
11 
12 // void resize(size_type sz, const value_type& x);
13 
14 #include <vector>
15 #include <cassert>
16 
17 #include "test_macros.h"
18 #include "min_allocator.h"
19 
20 int main(int, char**)
21 {
22     {
23         std::vector<bool> v(100);
24         v.resize(50, 1);
25         assert(v.size() == 50);
26         assert(v.capacity() >= 100);
27         assert(v == std::vector<bool>(50));
28         v.resize(200, 1);
29         assert(v.size() == 200);
30         assert(v.capacity() >= 200);
31         for (unsigned i = 0; i < 50; ++i)
32             assert(v[i] == 0);
33         for (unsigned i = 50; i < 200; ++i)
34             assert(v[i] == 1);
35     }
36 #if TEST_STD_VER >= 11
move_cursor(&self, n: usize) -> usize37     {
38         std::vector<bool, min_allocator<bool>> v(100);
39         v.resize(50, 1);
40         assert(v.size() == 50);
41         assert(v.capacity() >= 100);
42         assert((v == std::vector<bool, min_allocator<bool>>(50)));
43         v.resize(200, 1);
44         assert(v.size() == 200);
45         assert(v.capacity() >= 200);
46         for (unsigned i = 0; i < 50; ++i)
47             assert(v[i] == 0);
48         for (unsigned i = 50; i < 200; ++i)
49             assert(v[i] == 1);
50     }
open_that(&self, traversal: &Traversal)51 #endif
52 
53   return 0;
54 }
55