File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
libcxx/test/std/containers/sequences/vector.bool Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -26,9 +26,11 @@ TEST_CONSTEXPR_CXX20 bool tests() {
26
26
using C = std::vector<bool >;
27
27
C v (100 );
28
28
v.push_back (1 );
29
+ C::size_type before_cap = v.capacity ();
29
30
v.clear ();
30
31
v.shrink_to_fit ();
31
- assert (v.capacity () == 0 );
32
+ assert (v.capacity () <= before_cap);
33
+ LIBCPP_ASSERT (v.capacity () == 0 ); // libc++ honors the shrink_to_fit request as a QOI matter
32
34
assert (v.size () == 0 );
33
35
}
34
36
{
@@ -40,6 +42,11 @@ TEST_CONSTEXPR_CXX20 bool tests() {
40
42
assert (v.capacity () >= 101 );
41
43
assert (v.capacity () <= before_cap);
42
44
assert (v.size () == 101 );
45
+ v.erase (v.begin () + 1 , v.end ());
46
+ v.shrink_to_fit ();
47
+ assert (v.capacity () <= before_cap);
48
+ LIBCPP_ASSERT (v.capacity () == C (1 ).capacity ()); // libc++ honors the shrink_to_fit request as a QOI matter.
49
+ assert (v.size () == 1 );
43
50
}
44
51
45
52
#if defined(_LIBCPP_VERSION)
You can’t perform that action at this time.
0 commit comments