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() {
2626 using C = std::vector<bool >;
2727 C v (100 );
2828 v.push_back (1 );
29+ C::size_type before_cap = v.capacity ();
2930 v.clear ();
3031 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
3234 assert (v.size () == 0 );
3335 }
3436 {
@@ -40,6 +42,11 @@ TEST_CONSTEXPR_CXX20 bool tests() {
4042 assert (v.capacity () >= 101 );
4143 assert (v.capacity () <= before_cap);
4244 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 );
4350 }
4451
4552#if defined(_LIBCPP_VERSION)
You can’t perform that action at this time.
0 commit comments