[RISCV] Fix mgather -> riscv.masked.strided.load combine not extending indices (...
[llvm-project.git] / libcxx / test / std / containers / sequences / vector.bool / size.pass.cpp
blob33f8b72dd4722ce93a5488ea677422592663abd0
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>
11 // class vector
13 // size_type size() const noexcept;
15 #include <vector>
16 #include <cassert>
18 #include "test_macros.h"
19 #include "min_allocator.h"
21 TEST_CONSTEXPR_CXX20 bool tests()
24 typedef std::vector<bool> C;
25 C c;
26 ASSERT_NOEXCEPT(c.size());
27 assert(c.size() == 0);
28 c.push_back(false);
29 assert(c.size() == 1);
30 c.push_back(true);
31 assert(c.size() == 2);
32 c.push_back(false);
33 assert(c.size() == 3);
34 c.erase(c.begin());
35 assert(c.size() == 2);
36 c.erase(c.begin());
37 assert(c.size() == 1);
38 c.erase(c.begin());
39 assert(c.size() == 0);
41 #if TEST_STD_VER >= 11
43 typedef std::vector<bool, min_allocator<bool>> C;
44 C c;
45 ASSERT_NOEXCEPT(c.size());
46 assert(c.size() == 0);
47 c.push_back(false);
48 assert(c.size() == 1);
49 c.push_back(true);
50 assert(c.size() == 2);
51 c.push_back(false);
52 assert(c.size() == 3);
53 c.erase(c.begin());
54 assert(c.size() == 2);
55 c.erase(c.begin());
56 assert(c.size() == 1);
57 c.erase(c.begin());
58 assert(c.size() == 0);
60 #endif
62 return true;
65 int main(int, char**)
67 tests();
68 #if TEST_STD_VER > 17
69 static_assert(tests());
70 #endif
71 return 0;