[libc++] Prepare string.modifiers tests for constexpr
Reviewed By: ldionne, #libc Spies: libcxx-commits Differential Revision: https://reviews.llvm.org/D119329
This commit is contained in:
1 parent
e43b1ce4d5
commit
dcffa7d3e1
56 files changed
+2065
-1177
No files matched your search
+18
-9
@@ -18,7 +18,7 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
void
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S s, S str, S expected)
|
||||
{
|
||||
s.append(str);
|
||||
@@ -26,9 +26,8 @@ test(S s, S str, S expected)
|
||||
assert(s == expected);
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
{
|
||||
bool test() {
|
||||
{
|
||||
typedef std::string S;
|
||||
test(S(), S(), S());
|
||||
test(S(), S("12345"), S("12345"));
|
||||
@@ -50,9 +49,9 @@ int main(int, char**)
|
||||
test(S("12345678901234567890"), S("1234567890"), S("123456789012345678901234567890"));
|
||||
test(S("12345678901234567890"), S("12345678901234567890"),
|
||||
S("1234567890123456789012345678901234567890"));
|
||||
}
|
||||
}
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
{
|
||||
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
|
||||
test(S(), S(), S());
|
||||
test(S(), S("12345"), S("12345"));
|
||||
@@ -74,16 +73,26 @@ int main(int, char**)
|
||||
test(S("12345678901234567890"), S("1234567890"), S("123456789012345678901234567890"));
|
||||
test(S("12345678901234567890"), S("12345678901234567890"),
|
||||
S("1234567890123456789012345678901234567890"));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if TEST_STD_VER > 3
|
||||
{ // LWG 2946
|
||||
{ // LWG 2946
|
||||
std::string s;
|
||||
s.append({"abc", 1});
|
||||
assert(s.size() == 1);
|
||||
assert(s == "a");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
// static_assert(test());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in new issue
Block a user