[libc++] Prepare string tests for constexpr
These are the last™ changes to the tests for constexpr preparation. Reviewed By: Quuxplusone, #libc, Mordante Spies: Mordante, EricWF, libcxx-commits Differential Revision: https://reviews.llvm.org/D120951
This commit is contained in:
@@ -23,7 +23,7 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
void
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(typename S::size_type min_cap, typename S::size_type erased_index, typename S::size_type res_arg)
|
||||
{
|
||||
S s(min_cap, 'a');
|
||||
@@ -47,7 +47,7 @@ test(typename S::size_type min_cap, typename S::size_type erased_index, typename
|
||||
#endif
|
||||
}
|
||||
#ifndef TEST_HAS_NO_EXCEPTIONS
|
||||
else
|
||||
else if (!TEST_IS_CONSTANT_EVALUATED)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -28,7 +28,7 @@ test(S s, typename S::size_type n, S expected)
|
||||
assert(s == expected);
|
||||
}
|
||||
#ifndef TEST_HAS_NO_EXCEPTIONS
|
||||
else
|
||||
else if (!TEST_IS_CONSTANT_EVALUATED)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
void
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, typename S::size_type n, typename S::value_type c, S expected)
|
||||
{
|
||||
if (n <= s.max_size())
|
||||
@@ -28,7 +28,7 @@ test(S s, typename S::size_type n, typename S::value_type c, S expected)
|
||||
assert(s == expected);
|
||||
}
|
||||
#ifndef TEST_HAS_NO_EXCEPTIONS
|
||||
else
|
||||
else if (!TEST_IS_CONSTANT_EVALUATED)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
void
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s)
|
||||
{
|
||||
typename S::size_type old_cap = s.capacity();
|
||||
@@ -30,7 +30,7 @@ test(S s)
|
||||
}
|
||||
|
||||
bool test() {
|
||||
{
|
||||
{
|
||||
typedef std::string S;
|
||||
S s;
|
||||
test(s);
|
||||
@@ -42,9 +42,9 @@ bool test() {
|
||||
s.assign(100, 'a');
|
||||
s.erase(50);
|
||||
test(s);
|
||||
}
|
||||
}
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
{
|
||||
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
|
||||
S s;
|
||||
test(s);
|
||||
@@ -56,7 +56,7 @@ bool test() {
|
||||
s.assign(100, 'a');
|
||||
s.erase(50);
|
||||
test(s);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user