[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
+17
-8
@@ -26,9 +26,8 @@ test(S s, const typename S::value_type* str, S expected)
|
||||
assert(s == expected);
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
{
|
||||
bool test() {
|
||||
{
|
||||
typedef std::string S;
|
||||
test(S(), "", S());
|
||||
test(S(), "12345", S("12345"));
|
||||
@@ -42,9 +41,9 @@ int main(int, char**)
|
||||
test(S("12345678901234567890"), "12345", S("1234567890123456789012345"));
|
||||
test(S("12345678901234567890"), "12345678901234567890",
|
||||
S("1234567890123456789012345678901234567890"));
|
||||
}
|
||||
}
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
{
|
||||
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
|
||||
test(S(), "", S());
|
||||
test(S(), "12345", S("12345"));
|
||||
@@ -58,10 +57,10 @@ int main(int, char**)
|
||||
test(S("12345678901234567890"), "12345", S("1234567890123456789012345"));
|
||||
test(S("12345678901234567890"), "12345678901234567890",
|
||||
S("1234567890123456789012345678901234567890"));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
{ // test appending to self
|
||||
{ // test appending to self
|
||||
typedef std::string S;
|
||||
S s_short = "123/";
|
||||
S s_long = "Lorem ipsum dolor sit amet, consectetur/";
|
||||
@@ -75,7 +74,17 @@ int main(int, char**)
|
||||
|
||||
s_long.append(s_long.c_str());
|
||||
assert(s_long == "Lorem ipsum dolor sit amet, consectetur/Lorem ipsum dolor sit amet, consectetur/");
|
||||
}
|
||||
}
|
||||
|
||||
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