diff options
author | Marshall Clow <mclow.lists@gmail.com> | 2018-11-28 18:18:34 +0000 |
---|---|---|
committer | Marshall Clow <mclow.lists@gmail.com> | 2018-11-28 18:18:34 +0000 |
commit | 4d64d7dd641d385439a354db1f98cbb0ab7167f9 (patch) | |
tree | 92dad283f2876e7a9abc99640536de2378e30936 /libcxx/test/std/strings/basic.string/string.capacity/reserve.pass.cpp | |
parent | 647782c78b609fd03dff5bfd68cadf6ac2b7a5af (diff) | |
download | bcm5719-llvm-4d64d7dd641d385439a354db1f98cbb0ab7167f9.tar.gz bcm5719-llvm-4d64d7dd641d385439a354db1f98cbb0ab7167f9.zip |
Implement P0966 - string::reserve should not shrink
llvm-svn: 347789
Diffstat (limited to 'libcxx/test/std/strings/basic.string/string.capacity/reserve.pass.cpp')
-rw-r--r-- | libcxx/test/std/strings/basic.string/string.capacity/reserve.pass.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/libcxx/test/std/strings/basic.string/string.capacity/reserve.pass.cpp b/libcxx/test/std/strings/basic.string/string.capacity/reserve.pass.cpp index 7210152ea3c..8b9dc13db83 100644 --- a/libcxx/test/std/strings/basic.string/string.capacity/reserve.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.capacity/reserve.pass.cpp @@ -9,7 +9,9 @@ // <string> -// void reserve(size_type res_arg=0); +// Split into two calls for C++20 +// void reserve(); +// void reserve(size_type res_arg); #include <string> #include <stdexcept> @@ -44,6 +46,9 @@ test(S s, typename S::size_type res_arg) assert(s == s0); assert(s.capacity() >= res_arg); assert(s.capacity() >= s.size()); +#if TEST_STD_VER > 17 + assert(s.capacity() >= old_cap); // resize never shrinks as of P0966 +#endif } #ifndef TEST_HAS_NO_EXCEPTIONS else @@ -90,6 +95,7 @@ int main() test(s, 10); test(s, 50); test(s, 100); + test(s, 1000); test(s, S::npos); } } @@ -121,6 +127,7 @@ int main() test(s, 10); test(s, 50); test(s, 100); + test(s, 1000); test(s, S::npos); } } |