diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/robust_against_adl.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/robust_against_adl.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.modifiers/robust_against_adl.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.modifiers/robust_against_adl.pass.cpp @@ -11,6 +11,8 @@ #include #include +#include "test_macros.h" + struct Incomplete; template struct Holder { T t; }; @@ -21,15 +23,24 @@ operator char() const { return ch_; } }; +bool test() { + std::string s; + Charlike > a[] = {'m', 'a', 'h', 'i'}; + s.append(a, a+4); + s.assign(a, a+4); + s.insert(s.begin(), a, a+4); + s.replace(s.begin(), s.begin()+4, a, a+4); + assert(s == "mahimahi"); + + return true; +} + int main(int, char**) { - std::string s; - Charlike > a[] = {'m', 'a', 'h', 'i'}; - s.append(a, a+4); - s.assign(a, a+4); - s.insert(s.begin(), a, a+4); - s.replace(s.begin(), s.begin()+4, a, a+4); - assert(s == "mahimahi"); - - return 0; + test(); +#if TEST_STD_VER > 17 + // static_assert(test()); +#endif + + return 0; } diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/T_size_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/T_size_size.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/T_size_size.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/T_size_size.pass.cpp @@ -20,7 +20,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(S s, SV sv, typename S::size_type pos, typename S::size_type n, S expected) { if (pos <= sv.size()) @@ -46,7 +46,7 @@ } template -void +TEST_CONSTEXPR_CXX20 void test_npos(S s, SV sv, typename S::size_type pos, S expected) { if (pos <= sv.size()) @@ -71,9 +71,8 @@ #endif } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; typedef std::string_view SV; test(S(), SV(), 0, 0, S()); @@ -97,9 +96,9 @@ test(S("12345678901234567890"), SV("12345"), 1, 3, S("12345678901234567890234")); test(S("12345678901234567890"), SV("12345678901234567890"), 5, 10, S("123456789012345678906789012345")); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string , min_allocator> S; typedef std::basic_string_view > SV; test(S(), SV(), 0, 0, S()); @@ -123,9 +122,9 @@ test(S("12345678901234567890"), SV("12345"), 1, 3, S("12345678901234567890234")); test(S("12345678901234567890"), SV("12345678901234567890"), 5, 10, S("123456789012345678906789012345")); - } + } #endif - { + { typedef std::string S; typedef std::string_view SV; test_npos(S(), SV(), 0, S()); @@ -135,9 +134,9 @@ test_npos(S(), SV("12345"), 3, S("45")); test_npos(S(), SV("12345"), 5, S("")); test_npos(S(), SV("12345"), 6, S("not happening")); - } + } - { + { std::string s; std::string_view sv = "EFGH"; char arr[] = "IJKL"; @@ -169,9 +168,9 @@ s.append(arr, 0); // calls append(const char *, len) assert(s == ""); s.clear(); - } + } - { + { std::string s = "ABCD"; std::string_view sv = s; s.append(sv); @@ -184,9 +183,9 @@ sv = s; s.append(sv, sv.size()); assert(s == "ABCDABCDABCDABCD"); - } + } - { + { std::string s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; std::string_view sv = s; s.append(sv); @@ -195,7 +194,17 @@ sv = s; s.append(sv, 0, std::string::npos); assert(s == "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"); - } + } + + return true; +} + +int main(int, char**) +{ + test(); +#if TEST_STD_VER > 17 + // static_assert(test()); +#endif return 0; } diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/initializer_list.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/initializer_list.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/initializer_list.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/initializer_list.pass.cpp @@ -18,19 +18,28 @@ #include "test_macros.h" #include "min_allocator.h" +bool test() { + { + std::string s("123"); + s.append({'a', 'b', 'c'}); + assert(s == "123abc"); + } + { + typedef std::basic_string, min_allocator> S; + S s("123"); + s.append({'a', 'b', 'c'}); + assert(s == "123abc"); + } + + return true; +} + int main(int, char**) { - { - std::string s("123"); - s.append({'a', 'b', 'c'}); - assert(s == "123abc"); - } - { - typedef std::basic_string, min_allocator> S; - S s("123"); - s.append({'a', 'b', 'c'}); - assert(s == "123abc"); - } + test(); +#if TEST_STD_VER > 17 + // static_assert(test()); +#endif return 0; } diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp @@ -19,7 +19,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(S s, It first, It last, S expected) { s.append(first, last); @@ -31,7 +31,7 @@ struct Widget { operator char() const { throw 42; } }; template -void +TEST_CONSTEXPR_CXX20 void test_exceptions(S s, It first, It last) { S original = s; @@ -52,9 +52,8 @@ } #endif -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; const char* s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; test(S(), s, s, S()); @@ -111,9 +110,9 @@ S("12345678901234567890""ABCDEFGHIJ")); test(S("12345678901234567890"), cpp17_input_iterator(s), cpp17_input_iterator(s+52), S("12345678901234567890""ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; const char* s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; test(S(), s, s, S()); @@ -170,10 +169,10 @@ S("12345678901234567890""ABCDEFGHIJ")); test(S("12345678901234567890"), cpp17_input_iterator(s), cpp17_input_iterator(s+52), S("12345678901234567890""ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); - } + } #endif #ifndef TEST_HAS_NO_EXCEPTIONS - { // test iterator operations that throw + { // test iterator operations that throw typedef std::string S; typedef ThrowingIterator TIter; typedef cpp17_input_iterator IIter; @@ -188,10 +187,10 @@ Widget w[100]; test_exceptions(S(), w, w+100); - } + } #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/"; @@ -205,18 +204,18 @@ s_long.append(s_long.begin(), s_long.end()); assert(s_long == "Lorem ipsum dolor sit amet, consectetur/Lorem ipsum dolor sit amet, consectetur/"); - } + } - { // test appending a different type + { // test appending a different type typedef std::string S; const uint8_t p[] = "ABCD"; S s; s.append(p, p + 4); assert(s == "ABCD"); - } + } - { // regression-test appending to self in sneaky ways + { // regression-test appending to self in sneaky ways std::string s_short = "hello"; std::string s_long = "Lorem ipsum dolor sit amet, consectetur/"; std::string s_othertype = "hello"; @@ -231,7 +230,7 @@ s_sneaky.reserve(12); test(s_sneaky, s_sneaky.data(), s_sneaky.data() + 6, std::string("hellohello\0", 11)); - } + } { // test with a move iterator that returns char&& typedef forward_iterator It; @@ -250,5 +249,15 @@ assert(s == "ABCD"); } + return true; +} + +int main(int, char**) +{ + test(); +#if TEST_STD_VER > 17 + // static_assert(test()); +#endif + return 0; } diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/pointer.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/pointer.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/pointer.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/pointer.pass.cpp @@ -26,9 +26,8 @@ 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 @@ test(S("12345678901234567890"), "12345", S("1234567890123456789012345")); test(S("12345678901234567890"), "12345678901234567890", S("1234567890123456789012345678901234567890")); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; test(S(), "", S()); test(S(), "12345", S("12345")); @@ -58,10 +57,10 @@ 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 @@ 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; } diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/pointer_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/pointer_size.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/pointer_size.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/pointer_size.pass.cpp @@ -19,7 +19,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(S s, const typename S::value_type* str, typename S::size_type n, S expected) { s.append(str, n); @@ -27,9 +27,8 @@ assert(s == expected); } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; test(S(), "", 0, S()); test(S(), "12345", 3, S("123")); @@ -47,9 +46,9 @@ test(S("12345678901234567890"), "12345", 5, S("1234567890123456789012345")); test(S("12345678901234567890"), "12345678901234567890", 20, S("1234567890123456789012345678901234567890")); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; test(S(), "", 0, S()); test(S(), "12345", 3, S("123")); @@ -67,10 +66,10 @@ test(S("12345678901234567890"), "12345", 5, S("1234567890123456789012345")); test(S("12345678901234567890"), "12345678901234567890", 20, 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/"; @@ -84,7 +83,17 @@ s_long.append(s_long.data(), s_long.size()); 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; } diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp @@ -23,7 +23,7 @@ }; template -void +TEST_CONSTEXPR_CXX20 void test(S s, typename S::value_type c, S expected) { s.push_back(c); @@ -31,31 +31,40 @@ assert(s == expected); } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; test(S(), 'a', S(1, 'a')); test(S("12345"), 'a', S("12345a")); test(S("12345678901234567890"), 'a', S("12345678901234567890a")); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; test(S(), 'a', S(1, 'a')); test(S("12345"), 'a', S("12345a")); test(S("12345678901234567890"), 'a', S("12345678901234567890a")); - } + } #endif - { + { // https://llvm.org/PR31454 std::basic_string s; veryLarge vl = {}; s.push_back(vl); s.push_back(vl); s.push_back(vl); - } + } + + return true; +} + +int main(int, char**) +{ + test(); +#if TEST_STD_VER > 17 + // static_assert(test()); +#endif return 0; } diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/size_char.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/size_char.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/size_char.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/size_char.pass.cpp @@ -18,7 +18,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(S s, typename S::size_type n, typename S::value_type c, S expected) { s.append(n, c); @@ -26,9 +26,8 @@ assert(s == expected); } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; test(S(), 0, 'a', S()); test(S(), 1, 'a', S(1, 'a')); @@ -42,9 +41,9 @@ test(S("12345678901234567890"), 0, 'a', S("12345678901234567890")); test(S("12345678901234567890"), 1, 'a', S("12345678901234567890a")); test(S("12345678901234567890"), 10, 'a', S("12345678901234567890aaaaaaaaaa")); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; test(S(), 0, 'a', S()); test(S(), 1, 'a', S(1, 'a')); @@ -58,7 +57,17 @@ test(S("12345678901234567890"), 0, 'a', S("12345678901234567890")); test(S("12345678901234567890"), 1, 'a', S("12345678901234567890a")); test(S("12345678901234567890"), 10, 'a', S("12345678901234567890aaaaaaaaaa")); - } + } +#endif + + return true; +} + +int main(int, char**) +{ + test(); +#if TEST_STD_VER > 17 + // static_assert(test()); #endif return 0; diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/string.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/string.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/string.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/string.pass.cpp @@ -18,7 +18,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(S s, S str, S expected) { s.append(str); @@ -26,9 +26,8 @@ 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 @@ test(S("12345678901234567890"), S("1234567890"), S("123456789012345678901234567890")); test(S("12345678901234567890"), S("12345678901234567890"), S("1234567890123456789012345678901234567890")); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; test(S(), S(), S()); test(S(), S("12345"), S("12345")); @@ -74,16 +73,26 @@ 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; diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/string_size_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/string_size_size.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/string_size_size.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/string_size_size.pass.cpp @@ -20,7 +20,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(S s, S str, typename S::size_type pos, typename S::size_type n, S expected) { if (pos <= str.size()) @@ -46,7 +46,7 @@ } template -void +TEST_CONSTEXPR_CXX20 void test_npos(S s, S str, typename S::size_type pos, S expected) { if (pos <= str.size()) @@ -71,9 +71,8 @@ #endif } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; test(S(), S(), 0, 0, S()); test(S(), S(), 1, 0, S()); @@ -96,9 +95,9 @@ test(S("12345678901234567890"), S("12345"), 1, 3, S("12345678901234567890234")); test(S("12345678901234567890"), S("12345678901234567890"), 5, 10, S("123456789012345678906789012345")); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; test(S(), S(), 0, 0, S()); test(S(), S(), 1, 0, S()); @@ -121,9 +120,9 @@ test(S("12345678901234567890"), S("12345"), 1, 3, S("12345678901234567890234")); test(S("12345678901234567890"), S("12345678901234567890"), 5, 10, S("123456789012345678906789012345")); - } + } #endif - { + { typedef std::string S; test_npos(S(), S(), 0, S()); test_npos(S(), S(), 1, S()); @@ -132,7 +131,17 @@ test_npos(S(), S("12345"), 3, S("45")); test_npos(S(), S("12345"), 5, S("")); test_npos(S(), S("12345"), 6, S("not happening")); - } + } + + return true; +} + +int main(int, char**) +{ + test(); +#if TEST_STD_VER > 17 + // static_assert(test()); +#endif return 0; } diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/string_view.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/string_view.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/string_view.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/string_view.pass.cpp @@ -19,7 +19,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(S s, SV sv, S expected) { s.append(sv); @@ -27,9 +27,8 @@ assert(s == expected); } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; typedef std::string_view SV; test(S(), SV(), S()); @@ -52,9 +51,9 @@ test(S("12345678901234567890"), SV("1234567890"), S("123456789012345678901234567890")); test(S("12345678901234567890"), SV("12345678901234567890"), S("1234567890123456789012345678901234567890")); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string , min_allocator> S; typedef std::basic_string_view > SV; test(S(), SV(), S()); @@ -77,7 +76,17 @@ test(S("12345678901234567890"), SV("1234567890"), S("123456789012345678901234567890")); test(S("12345678901234567890"), SV("12345678901234567890"), S("1234567890123456789012345678901234567890")); - } + } +#endif + + return true; +} + +int main(int, char**) +{ + test(); +#if TEST_STD_VER > 17 + // static_assert(test()); #endif return 0; diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/T_size_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/T_size_size.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/T_size_size.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/T_size_size.pass.cpp @@ -70,9 +70,8 @@ #endif } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; typedef std::string_view SV; test(S(), SV(), 0, 0, S()); @@ -96,9 +95,9 @@ test(S("12345678901234567890"), SV("12345"), 1, 3, S("234")); test(S("12345678901234567890"), SV("12345678901234567890"), 5, 10, S("6789012345")); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string , min_allocator> S; typedef std::basic_string_view > SV; test(S(), SV(), 0, 0, S()); @@ -122,9 +121,9 @@ test(S("12345678901234567890"), SV("12345"), 1, 3, S("234")); test(S("12345678901234567890"), SV("12345678901234567890"), 5, 10, S("6789012345")); - } + } #endif - { + { typedef std::string S; typedef std::string_view SV; test_npos(S(), SV(), 0, S()); @@ -134,9 +133,9 @@ test_npos(S(), SV("12345"), 3, S("45")); test_npos(S(), SV("12345"), 5, S("")); test_npos(S(), SV("12345"), 6, S("not happening")); - } + } - { + { std::string s = "ABCD"; std::string_view sv = "EFGH"; char arr[] = "IJKL"; @@ -168,9 +167,9 @@ s.assign(arr, 0); // calls assign(const char *, len) assert(s == ""); s.clear(); - } + } - { + { std::string s = "ABCD"; std::string_view sv = s; s.assign(sv); @@ -179,9 +178,9 @@ sv = s; s.assign(sv, 0, std::string::npos); assert(s == "ABCD"); - } + } - { + { std::string s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; std::string_view sv = s; s.assign(sv); @@ -190,7 +189,17 @@ sv = s; s.assign(sv, 0, std::string::npos); assert(s == "ABCDEFGHIJKLMNOPQRSTUVWXYZ"); - } + } + + return true; +} + +int main(int, char**) +{ + test(); +#if TEST_STD_VER > 17 + // static_assert(test()); +#endif return 0; } diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/initializer_list.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/initializer_list.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/initializer_list.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/initializer_list.pass.cpp @@ -18,19 +18,28 @@ #include "test_macros.h" #include "min_allocator.h" +bool test() { + { + std::string s("123"); + s.assign({'a', 'b', 'c'}); + assert(s == "abc"); + } + { + typedef std::basic_string, min_allocator> S; + S s("123"); + s.assign({'a', 'b', 'c'}); + assert(s == "abc"); + } + + return true; +} + int main(int, char**) { - { - std::string s("123"); - s.assign({'a', 'b', 'c'}); - assert(s == "abc"); - } - { - typedef std::basic_string, min_allocator> S; - S s("123"); - s.assign({'a', 'b', 'c'}); - assert(s == "abc"); - } + test(); +#if TEST_STD_VER > 17 + // static_assert(test()); +#endif return 0; } diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/iterator.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/iterator.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/iterator.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/iterator.pass.cpp @@ -52,9 +52,8 @@ } #endif -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; const char* s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; test(S(), s, s, S()); @@ -111,9 +110,9 @@ S("ABCDEFGHIJ")); test(S("12345678901234567890"), cpp17_input_iterator(s), cpp17_input_iterator(s+52), S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; const char* s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; test(S(), s, s, S()); @@ -170,10 +169,10 @@ S("ABCDEFGHIJ")); test(S("12345678901234567890"), cpp17_input_iterator(s), cpp17_input_iterator(s+52), S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); - } + } #endif #ifndef TEST_HAS_NO_EXCEPTIONS - { // test iterator operations that throw + { // test iterator operations that throw typedef std::string S; typedef ThrowingIterator TIter; typedef cpp17_input_iterator IIter; @@ -188,10 +187,10 @@ Widget w[100]; test_exceptions(S(), w, w+100); - } + } #endif - { // test assigning to self + { // test assigning to self typedef std::string S; S s_short = "123/"; S s_long = "Lorem ipsum dolor sit amet, consectetur/"; @@ -206,23 +205,33 @@ s_long.assign(s_long.begin() + 30, s_long.end()); assert(s_long == "nsectetur/"); - } + } - { // test assigning a different type + { // test assigning a different type typedef std::string S; const uint8_t p[] = "ABCD"; S s; s.assign(p, p + 4); assert(s == "ABCD"); - } + } - { // regression-test assigning to self in sneaky ways + { // regression-test assigning to self in sneaky ways std::string sneaky = "hello"; sneaky.resize(sneaky.capacity(), 'x'); std::string expected = sneaky + std::string(1, '\0'); test(sneaky, sneaky.data(), sneaky.data() + sneaky.size() + 1, expected); - } + } + + return true; +} + +int main(int, char**) +{ + test(); +#if TEST_STD_VER > 17 + // static_assert(test()); +#endif return 0; } diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/pointer.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/pointer.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/pointer.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/pointer.pass.cpp @@ -18,7 +18,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(S s, const typename S::value_type* str, S expected) { s.assign(str); @@ -26,9 +26,8 @@ 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 @@ test(S("12345678901234567890"), "12345", S("12345")); test(S("12345678901234567890"), "12345678901234567890", S("12345678901234567890")); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; test(S(), "", S()); test(S(), "12345", S("12345")); @@ -58,10 +57,10 @@ test(S("12345678901234567890"), "12345", S("12345")); test(S("12345678901234567890"), "12345678901234567890", S("12345678901234567890")); - } + } #endif - { // test assignment to self + { // test assignment to self typedef std::string S; S s_short = "123/"; S s_long = "Lorem ipsum dolor sit amet, consectetur/"; @@ -73,7 +72,17 @@ s_long.assign(s_long.c_str() + 30); assert(s_long == "nsectetur/"); - } + } + + return true; +} + +int main(int, char**) +{ + test(); +#if TEST_STD_VER > 17 + // static_assert(test()); +#endif return 0; } diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/pointer_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/pointer_size.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/pointer_size.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/pointer_size.pass.cpp @@ -19,7 +19,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(S s, const typename S::value_type* str, typename S::size_type n, S expected) { s.assign(str, n); @@ -27,9 +27,8 @@ assert(s == expected); } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; test(S(), "", 0, S()); test(S(), "12345", 3, S("123")); @@ -47,9 +46,9 @@ test(S("12345678901234567890"), "12345", 5, S("12345")); test(S("12345678901234567890"), "12345678901234567890", 20, S("12345678901234567890")); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; test(S(), "", 0, S()); test(S(), "12345", 3, S("123")); @@ -67,9 +66,9 @@ test(S("12345678901234567890"), "12345", 5, S("12345")); test(S("12345678901234567890"), "12345678901234567890", 20, S("12345678901234567890")); - } + } #endif - { // test assign to self + { // test assign to self typedef std::string S; S s_short = "123/"; S s_long = "Lorem ipsum dolor sit amet, consectetur/"; @@ -84,7 +83,17 @@ s_long.assign(s_long.data() + 2, 8 ); assert(s_long == "rem ipsu"); - } + } + + return true; +} + +int main(int, char**) +{ + test(); +#if TEST_STD_VER > 17 + // static_assert(test()); +#endif return 0; } diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/rv_string.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/rv_string.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/rv_string.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/rv_string.pass.cpp @@ -19,7 +19,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(S s, S str, S expected) { s.assign(std::move(str)); @@ -27,9 +27,8 @@ assert(s == expected); } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; test(S(), S(), S()); test(S(), S("12345"), S("12345")); @@ -51,9 +50,9 @@ test(S("12345678901234567890"), S("1234567890"), S("1234567890")); test(S("12345678901234567890"), S("12345678901234567890"), S("12345678901234567890")); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; test(S(), S(), S()); test(S(), S("12345"), S("12345")); @@ -75,7 +74,17 @@ test(S("12345678901234567890"), S("1234567890"), S("1234567890")); test(S("12345678901234567890"), S("12345678901234567890"), S("12345678901234567890")); - } + } +#endif + + return true; +} + +int main(int, char**) +{ + test(); +#if TEST_STD_VER > 17 + // static_assert(test()); #endif return 0; diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/size_char.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/size_char.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/size_char.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/size_char.pass.cpp @@ -18,7 +18,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(S s, typename S::size_type n, typename S::value_type c, S expected) { s.assign(n, c); @@ -26,9 +26,8 @@ assert(s == expected); } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; test(S(), 0, 'a', S()); test(S(), 1, 'a', S(1, 'a')); @@ -42,9 +41,9 @@ test(S("12345678901234567890"), 0, 'a', S()); test(S("12345678901234567890"), 1, 'a', S(1, 'a')); test(S("12345678901234567890"), 10, 'a', S(10, 'a')); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; test(S(), 0, 'a', S()); test(S(), 1, 'a', S(1, 'a')); @@ -58,7 +57,17 @@ test(S("12345678901234567890"), 0, 'a', S()); test(S("12345678901234567890"), 1, 'a', S(1, 'a')); test(S("12345678901234567890"), 10, 'a', S(10, 'a')); - } + } +#endif + + return true; +} + +int main(int, char**) +{ + test(); +#if TEST_STD_VER > 17 + // static_assert(test()); #endif return 0; diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/string.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/string.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/string.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/string.pass.cpp @@ -19,7 +19,7 @@ #include "test_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(S s, S str, S expected) { s.assign(str); @@ -28,7 +28,7 @@ } template -void +TEST_CONSTEXPR_CXX20 void testAlloc(S s, S str, const typename S::allocator_type& a) { s.assign(str); @@ -37,9 +37,8 @@ assert(s.get_allocator() == a); } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; test(S(), S(), S()); test(S(), S("12345"), S("12345")); @@ -66,19 +65,19 @@ testAlloc(S(), S("12345"), std::allocator()); testAlloc(S(), S("1234567890"), std::allocator()); testAlloc(S(), S("12345678901234567890"), std::allocator()); - } + } - { // LWG#5579 make sure assign takes the allocators where appropriate + { // LWG#5579 make sure assign takes the allocators where appropriate typedef other_allocator A; // has POCCA --> true typedef std::basic_string, A> S; testAlloc(S(A(5)), S(A(3)), A(3)); testAlloc(S(A(5)), S("1"), A()); testAlloc(S(A(5)), S("1", A(7)), A(7)); testAlloc(S(A(5)), S("1234567890123456789012345678901234567890123456789012345678901234567890", A(7)), A(7)); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; test(S(), S(), S()); test(S(), S("12345"), S("12345")); @@ -105,13 +104,23 @@ testAlloc(S(), S("12345"), min_allocator()); testAlloc(S(), S("1234567890"), min_allocator()); testAlloc(S(), S("12345678901234567890"), min_allocator()); - } + } #endif #if TEST_STD_VER > 14 - { + { typedef std::string S; static_assert(noexcept(S().assign(S())), ""); // LWG#2063 - } + } +#endif + + return true; +} + +int main(int, char**) +{ + test(); +#if TEST_STD_VER > 17 + // static_assert(test()); #endif return 0; diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/string_size_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/string_size_size.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/string_size_size.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/string_size_size.pass.cpp @@ -20,7 +20,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(S s, S str, typename S::size_type pos, typename S::size_type n, S expected) { if (pos <= str.size()) @@ -46,7 +46,7 @@ } template -void +TEST_CONSTEXPR_CXX20 void test_npos(S s, S str, typename S::size_type pos, S expected) { if (pos <= str.size()) @@ -71,9 +71,8 @@ #endif } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; test(S(), S(), 0, 0, S()); test(S(), S(), 1, 0, S()); @@ -96,9 +95,9 @@ test(S("12345678901234567890"), S("12345"), 1, 3, S("234")); test(S("12345678901234567890"), S("12345678901234567890"), 5, 10, S("6789012345")); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; test(S(), S(), 0, 0, S()); test(S(), S(), 1, 0, S()); @@ -121,9 +120,9 @@ test(S("12345678901234567890"), S("12345"), 1, 3, S("234")); test(S("12345678901234567890"), S("12345678901234567890"), 5, 10, S("6789012345")); - } + } #endif - { + { typedef std::string S; test_npos(S(), S(), 0, S()); test_npos(S(), S(), 1, S()); @@ -132,7 +131,17 @@ test_npos(S(), S("12345"), 3, S("45")); test_npos(S(), S("12345"), 5, S("")); test_npos(S(), S("12345"), 6, S("not happening")); - } + } + + return true; +} + +int main(int, char**) +{ + test(); +#if TEST_STD_VER > 17 + // static_assert(test()); +#endif return 0; } diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/string_view.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/string_view.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/string_view.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/string_view.pass.cpp @@ -20,7 +20,7 @@ #include "test_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(S s, SV sv, S expected) { s.assign(sv); @@ -29,7 +29,7 @@ } template -void +TEST_CONSTEXPR_CXX20 void testAlloc(S s, SV sv, const typename S::allocator_type& a) { s.assign(sv); @@ -38,9 +38,8 @@ assert(s.get_allocator() == a); } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; typedef std::string_view SV; test(S(), SV(), S()); @@ -68,10 +67,10 @@ testAlloc(S(), SV("12345"), std::allocator()); testAlloc(S(), SV("1234567890"), std::allocator()); testAlloc(S(), SV("12345678901234567890"), std::allocator()); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string , min_allocator> S; typedef std::basic_string_view > SV; test(S(), SV(), S()); @@ -99,7 +98,17 @@ testAlloc(S(), SV("12345"), min_allocator()); testAlloc(S(), SV("1234567890"), min_allocator()); testAlloc(S(), SV("12345678901234567890"), min_allocator()); - } + } +#endif + + return true; +} + +int main(int, char**) +{ + test(); +#if TEST_STD_VER > 17 + // static_assert(test()); #endif return 0; diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_copy/copy.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_copy/copy.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.modifiers/string_copy/copy.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_copy/copy.pass.cpp @@ -49,9 +49,8 @@ #endif } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; char s[50]; test(S(""), s, 0, 0); @@ -112,9 +111,9 @@ test(S("abcdefghijklmnopqrst"), s, 20, 0); test(S("abcdefghijklmnopqrst"), s, 20, 1); test(S("abcdefghijklmnopqrst"), s, 21, 0); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; char s[50]; test(S(""), s, 0, 0); @@ -175,7 +174,17 @@ test(S("abcdefghijklmnopqrst"), s, 20, 0); test(S("abcdefghijklmnopqrst"), s, 20, 1); test(S("abcdefghijklmnopqrst"), s, 21, 0); - } + } +#endif + + return true; +} + +int main(int, char**) +{ + test(); +#if TEST_STD_VER > 17 + // static_assert(test()); #endif return 0; diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_erase/iter.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_erase/iter.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.modifiers/string_erase/iter.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_erase/iter.pass.cpp @@ -17,7 +17,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(S s, typename S::difference_type pos, S expected) { typename S::const_iterator p = s.begin() + pos; @@ -28,9 +28,8 @@ assert(i - s.begin() == pos); } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; test(S("abcde"), 0, S("bcde")); test(S("abcde"), 1, S("acde")); @@ -44,9 +43,9 @@ test(S("abcdefghijklmnopqrst"), 1, S("acdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 10, S("abcdefghijlmnopqrst")); test(S("abcdefghijklmnopqrst"), 19, S("abcdefghijklmnopqrs")); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; test(S("abcde"), 0, S("bcde")); test(S("abcde"), 1, S("acde")); @@ -60,7 +59,17 @@ test(S("abcdefghijklmnopqrst"), 1, S("acdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 10, S("abcdefghijlmnopqrst")); test(S("abcdefghijklmnopqrst"), 19, S("abcdefghijklmnopqrs")); - } + } +#endif + + return true; +} + +int main(int, char**) +{ + test(); +#if TEST_STD_VER > 17 + // static_assert(test()); #endif return 0; diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_erase/iter_iter.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_erase/iter_iter.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.modifiers/string_erase/iter_iter.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_erase/iter_iter.pass.cpp @@ -17,7 +17,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(S s, typename S::difference_type pos, typename S::difference_type n, S expected) { typename S::const_iterator first = s.cbegin() + pos; @@ -29,9 +29,8 @@ assert(i - s.begin() == pos); } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; test(S(""), 0, 0, S("")); test(S("abcde"), 0, 0, S("abcde")); @@ -87,9 +86,9 @@ test(S("abcdefghijklmnopqrst"), 19, 0, S("abcdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 19, 1, S("abcdefghijklmnopqrs")); test(S("abcdefghijklmnopqrst"), 20, 0, S("abcdefghijklmnopqrst")); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; test(S(""), 0, 0, S("")); test(S("abcde"), 0, 0, S("abcde")); @@ -145,7 +144,17 @@ test(S("abcdefghijklmnopqrst"), 19, 0, S("abcdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 19, 1, S("abcdefghijklmnopqrs")); test(S("abcdefghijklmnopqrst"), 20, 0, S("abcdefghijklmnopqrst")); - } + } +#endif + + return true; +} + +int main(int, char**) +{ + test(); +#if TEST_STD_VER > 17 + // static_assert(test()); #endif return 0; diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_erase/pop_back.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_erase/pop_back.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.modifiers/string_erase/pop_back.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_erase/pop_back.pass.cpp @@ -17,7 +17,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(S s, S expected) { s.pop_back(); @@ -26,21 +26,30 @@ assert(s == expected); } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; test(S("abcde"), S("abcd")); test(S("abcdefghij"), S("abcdefghi")); test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrs")); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; test(S("abcde"), S("abcd")); test(S("abcdefghij"), S("abcdefghi")); test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrs")); - } + } +#endif + + return true; +} + +int main(int, char**) +{ + test(); +#if TEST_STD_VER > 17 + // static_assert(test()); #endif return 0; diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp @@ -19,7 +19,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(S s, typename S::size_type pos, typename S::size_type n, S expected) { const typename S::size_type old_size = s.size(); @@ -49,7 +49,7 @@ } template -void +TEST_CONSTEXPR_CXX20 void test(S s, typename S::size_type pos, S expected) { const typename S::size_type old_size = s.size(); @@ -79,7 +79,7 @@ } template -void +TEST_CONSTEXPR_CXX20 void test(S s, S expected) { s.erase(); @@ -88,9 +88,8 @@ assert(s == expected); } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; test(S(""), 0, 0, S("")); test(S(""), 0, 1, S("")); @@ -192,9 +191,9 @@ test(S("abcde"), S("")); test(S("abcdefghij"), S("")); test(S("abcdefghijklmnopqrst"), S("")); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; test(S(""), 0, 0, S("")); test(S(""), 0, 1, S("")); @@ -296,7 +295,17 @@ test(S("abcde"), S("")); test(S("abcdefghij"), S("")); test(S("abcdefghijklmnopqrst"), S("")); - } + } +#endif + + return true; +} + +int main(int, char**) +{ + test(); +#if TEST_STD_VER > 17 + // static_assert(test()); #endif return 0; diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_char.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_char.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_char.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_char.pass.cpp @@ -18,7 +18,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(S& s, typename S::const_iterator p, typename S::value_type c, S expected) { bool sufficient_cap = s.size() < s.capacity(); @@ -32,9 +32,8 @@ assert(i == p); } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; S s; test(s, s.begin(), '1', S("1")); @@ -51,9 +50,9 @@ test(s, s.begin()+4, 'A', S("a567A1432dcb")); test(s, s.begin()+5, 'B', S("a567AB1432dcb")); test(s, s.begin()+6, 'C', S("a567ABC1432dcb")); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; S s; test(s, s.begin(), '1', S("1")); @@ -70,7 +69,17 @@ test(s, s.begin()+4, 'A', S("a567A1432dcb")); test(s, s.begin()+5, 'B', S("a567AB1432dcb")); test(s, s.begin()+6, 'C', S("a567ABC1432dcb")); - } + } +#endif + + return true; +} + +int main(int, char**) +{ + test(); +#if TEST_STD_VER > 17 + // static_assert(test()); #endif return 0; diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_initializer_list.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_initializer_list.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_initializer_list.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_initializer_list.pass.cpp @@ -19,21 +19,30 @@ #include "test_macros.h" #include "min_allocator.h" +bool test() { + { + std::string s("123456"); + std::string::iterator i = s.insert(s.begin() + 3, {'a', 'b', 'c'}); + assert(i - s.begin() == 3); + assert(s == "123abc456"); + } + { + typedef std::basic_string, min_allocator> S; + S s("123456"); + S::iterator i = s.insert(s.begin() + 3, {'a', 'b', 'c'}); + assert(i - s.begin() == 3); + assert(s == "123abc456"); + } + + return true; +} + int main(int, char**) { - { - std::string s("123456"); - std::string::iterator i = s.insert(s.begin() + 3, {'a', 'b', 'c'}); - assert(i - s.begin() == 3); - assert(s == "123abc456"); - } - { - typedef std::basic_string, min_allocator> S; - S s("123456"); - S::iterator i = s.insert(s.begin() + 3, {'a', 'b', 'c'}); - assert(i - s.begin() == 3); - assert(s == "123abc456"); - } + test(); +#if TEST_STD_VER > 17 + // static_assert(test()); +#endif return 0; } diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_iter_iter.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_iter_iter.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_iter_iter.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_iter_iter.pass.cpp @@ -19,7 +19,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(S s, typename S::difference_type pos, It first, It last, S expected) { typename S::const_iterator p = s.cbegin() + pos; @@ -33,7 +33,7 @@ struct Widget { operator char() const { throw 42; } }; template -void +TEST_CONSTEXPR_CXX20 void test_exceptions(S s, typename S::difference_type pos, It first, It last) { typename S::const_iterator p = s.cbegin() + pos; @@ -56,9 +56,8 @@ } #endif -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; const char* s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; test(S(), 0, s, s, S()); @@ -102,9 +101,9 @@ test(S("12345678901234567890"), 15, cpp17_input_iterator(s), cpp17_input_iterator(s+10), S("123456789012345ABCDEFGHIJ67890")); test(S("12345678901234567890"), 20, cpp17_input_iterator(s), cpp17_input_iterator(s+52), S("12345678901234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; const char* s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; test(S(), 0, s, s, S()); @@ -148,10 +147,10 @@ test(S("12345678901234567890"), 15, cpp17_input_iterator(s), cpp17_input_iterator(s+10), S("123456789012345ABCDEFGHIJ67890")); test(S("12345678901234567890"), 20, cpp17_input_iterator(s), cpp17_input_iterator(s+52), S("12345678901234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); - } + } #endif #ifndef TEST_HAS_NO_EXCEPTIONS - { // test iterator operations that throw + { // test iterator operations that throw typedef std::string S; typedef ThrowingIterator TIter; typedef cpp17_input_iterator IIter; @@ -166,10 +165,10 @@ Widget w[100]; test_exceptions(S(), 0, w, w+100); - } + } #endif - { // test inserting into self + { // test inserting into self typedef std::string S; S s_short = "123/"; S s_long = "Lorem ipsum dolor sit amet, consectetur/"; @@ -183,18 +182,18 @@ s_long.insert(s_long.begin(), s_long.begin(), s_long.end()); assert(s_long == "Lorem ipsum dolor sit amet, consectetur/Lorem ipsum dolor sit amet, consectetur/"); - } + } - { // test assigning a different type + { // test assigning a different type typedef std::string S; const uint8_t p[] = "ABCD"; S s; s.insert(s.begin(), p, p + 4); assert(s == "ABCD"); - } + } - { // regression-test inserting into self in sneaky ways + { // regression-test inserting into self in sneaky ways std::string s_short = "hello"; std::string s_long = "Lorem ipsum dolor sit amet, consectetur/"; std::string s_othertype = "hello"; @@ -205,7 +204,7 @@ test(s_long, 0, s_long.data() + s_long.size(), s_long.data() + s_long.size() + 1, std::string("\0Lorem ipsum dolor sit amet, consectetur/", 41)); test(s_othertype, 1, first + 2, first + 5, std::string("hlloello")); - } + } { // test with a move iterator that returns char&& typedef cpp17_input_iterator It; @@ -232,5 +231,15 @@ assert(s == "ABCD"); } + return true; +} + +int main(int, char**) +{ + test(); +#if TEST_STD_VER > 17 + // static_assert(test()); +#endif + return 0; } diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_size_char.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_size_char.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_size_char.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_size_char.pass.cpp @@ -17,7 +17,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(S s, typename S::difference_type pos, typename S::size_type n, typename S::value_type c, S expected) { @@ -28,9 +28,8 @@ assert(s == expected); } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; test(S(""), 0, 0, '1', S("")); test(S(""), 0, 5, '1', S("11111")); @@ -96,9 +95,9 @@ test(S("abcdefghijklmnopqrst"), 20, 5, '1', S("abcdefghijklmnopqrst11111")); test(S("abcdefghijklmnopqrst"), 20, 10, '1', S("abcdefghijklmnopqrst1111111111")); test(S("abcdefghijklmnopqrst"), 20, 20, '1', S("abcdefghijklmnopqrst11111111111111111111")); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; test(S(""), 0, 0, '1', S("")); test(S(""), 0, 5, '1', S("11111")); @@ -164,7 +163,17 @@ test(S("abcdefghijklmnopqrst"), 20, 5, '1', S("abcdefghijklmnopqrst11111")); test(S("abcdefghijklmnopqrst"), 20, 10, '1', S("abcdefghijklmnopqrst1111111111")); test(S("abcdefghijklmnopqrst"), 20, 20, '1', S("abcdefghijklmnopqrst11111111111111111111")); - } + } +#endif + + return true; +} + +int main(int, char**) +{ + test(); +#if TEST_STD_VER > 17 + // static_assert(test()); #endif return 0; diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_T_size_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_T_size_size.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_T_size_size.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_T_size_size.pass.cpp @@ -21,7 +21,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(S s, typename S::size_type pos1, SV sv, typename S::size_type pos2, typename S::size_type n, S expected) { @@ -52,7 +52,7 @@ } template -void +TEST_CONSTEXPR_CXX20 void test_npos(S s, typename S::size_type pos1, SV sv, typename S::size_type pos2, S expected) { static_assert((!std::is_same::value), ""); @@ -83,7 +83,7 @@ template -void test0() +TEST_CONSTEXPR_CXX20 bool test0() { test(S(""), 0, SV(""), 0, 0, S("")); test(S(""), 0, SV(""), 0, 1, S("")); @@ -135,10 +135,12 @@ test(S(""), 0, SV("1234567890"), 10, 0, S("")); test(S(""), 0, SV("1234567890"), 10, 1, S("")); test(S(""), 0, SV("1234567890"), 11, 0, S("can't happen")); + + return true; } template -void test1() +TEST_CONSTEXPR_CXX20 bool test1() { test(S(""), 0, SV("12345678901234567890"), 0, 0, S("")); test(S(""), 0, SV("12345678901234567890"), 0, 1, S("1")); @@ -190,10 +192,12 @@ test(S(""), 1, SV("12345"), 5, 0, S("can't happen")); test(S(""), 1, SV("12345"), 5, 1, S("can't happen")); test(S(""), 1, SV("12345"), 6, 0, S("can't happen")); + + return true; } template -void test2() +TEST_CONSTEXPR_CXX20 bool test2() { test(S(""), 1, SV("1234567890"), 0, 0, S("can't happen")); test(S(""), 1, SV("1234567890"), 0, 1, S("can't happen")); @@ -245,10 +249,12 @@ test(S(""), 1, SV("12345678901234567890"), 21, 0, S("can't happen")); test(S("abcde"), 0, SV(""), 0, 0, S("abcde")); test(S("abcde"), 0, SV(""), 0, 1, S("abcde")); + + return true; } template -void test3() +TEST_CONSTEXPR_CXX20 bool test3() { test(S("abcde"), 0, SV(""), 1, 0, S("can't happen")); test(S("abcde"), 0, SV("12345"), 0, 0, S("abcde")); @@ -300,10 +306,12 @@ test(S("abcde"), 0, SV("1234567890"), 11, 0, S("can't happen")); test(S("abcde"), 0, SV("12345678901234567890"), 0, 0, S("abcde")); test(S("abcde"), 0, SV("12345678901234567890"), 0, 1, S("1abcde")); + + return true; } template -void test4() +TEST_CONSTEXPR_CXX20 bool test4() { test(S("abcde"), 0, SV("12345678901234567890"), 0, 10, S("1234567890abcde")); test(S("abcde"), 0, SV("12345678901234567890"), 0, 19, S("1234567890123456789abcde")); @@ -355,10 +363,12 @@ test(S("abcde"), 1, SV("12345"), 6, 0, S("can't happen")); test(S("abcde"), 1, SV("1234567890"), 0, 0, S("abcde")); test(S("abcde"), 1, SV("1234567890"), 0, 1, S("a1bcde")); + + return true; } template -void test5() +TEST_CONSTEXPR_CXX20 bool test5() { test(S("abcde"), 1, SV("1234567890"), 0, 5, S("a12345bcde")); test(S("abcde"), 1, SV("1234567890"), 0, 9, S("a123456789bcde")); @@ -410,10 +420,12 @@ test(S("abcde"), 2, SV(""), 0, 1, S("abcde")); test(S("abcde"), 2, SV(""), 1, 0, S("can't happen")); test(S("abcde"), 2, SV("12345"), 0, 0, S("abcde")); + + return true; } template -void test6() +TEST_CONSTEXPR_CXX20 bool test6() { test(S("abcde"), 2, SV("12345"), 0, 1, S("ab1cde")); test(S("abcde"), 2, SV("12345"), 0, 2, S("ab12cde")); @@ -465,10 +477,12 @@ test(S("abcde"), 2, SV("12345678901234567890"), 0, 1, S("ab1cde")); test(S("abcde"), 2, SV("12345678901234567890"), 0, 10, S("ab1234567890cde")); test(S("abcde"), 2, SV("12345678901234567890"), 0, 19, S("ab1234567890123456789cde")); + + return true; } template -void test7() +TEST_CONSTEXPR_CXX20 bool test7() { test(S("abcde"), 2, SV("12345678901234567890"), 0, 20, S("ab12345678901234567890cde")); test(S("abcde"), 2, SV("12345678901234567890"), 0, 21, S("ab12345678901234567890cde")); @@ -520,10 +534,12 @@ test(S("abcde"), 4, SV("1234567890"), 0, 1, S("abcd1e")); test(S("abcde"), 4, SV("1234567890"), 0, 5, S("abcd12345e")); test(S("abcde"), 4, SV("1234567890"), 0, 9, S("abcd123456789e")); + + return true; } template -void test8() +TEST_CONSTEXPR_CXX20 bool test8() { test(S("abcde"), 4, SV("1234567890"), 0, 10, S("abcd1234567890e")); test(S("abcde"), 4, SV("1234567890"), 0, 11, S("abcd1234567890e")); @@ -575,10 +591,12 @@ test(S("abcde"), 5, SV("12345"), 0, 0, S("abcde")); test(S("abcde"), 5, SV("12345"), 0, 1, S("abcde1")); test(S("abcde"), 5, SV("12345"), 0, 2, S("abcde12")); + + return true; } template -void test9() +TEST_CONSTEXPR_CXX20 bool test9() { test(S("abcde"), 5, SV("12345"), 0, 4, S("abcde1234")); test(S("abcde"), 5, SV("12345"), 0, 5, S("abcde12345")); @@ -630,10 +648,12 @@ test(S("abcde"), 5, SV("12345678901234567890"), 0, 19, S("abcde1234567890123456789")); test(S("abcde"), 5, SV("12345678901234567890"), 0, 20, S("abcde12345678901234567890")); test(S("abcde"), 5, SV("12345678901234567890"), 0, 21, S("abcde12345678901234567890")); + + return true; } template -void test10() +TEST_CONSTEXPR_CXX20 bool test10() { test(S("abcde"), 5, SV("12345678901234567890"), 1, 0, S("abcde")); test(S("abcde"), 5, SV("12345678901234567890"), 1, 1, S("abcde2")); @@ -685,10 +705,12 @@ test(S("abcde"), 6, SV("1234567890"), 0, 9, S("can't happen")); test(S("abcde"), 6, SV("1234567890"), 0, 10, S("can't happen")); test(S("abcde"), 6, SV("1234567890"), 0, 11, S("can't happen")); + + return true; } template -void test11() +TEST_CONSTEXPR_CXX20 bool test11() { test(S("abcde"), 6, SV("1234567890"), 1, 0, S("can't happen")); test(S("abcde"), 6, SV("1234567890"), 1, 1, S("can't happen")); @@ -740,10 +762,12 @@ test(S("abcdefghij"), 0, SV("12345"), 0, 2, S("12abcdefghij")); test(S("abcdefghij"), 0, SV("12345"), 0, 4, S("1234abcdefghij")); test(S("abcdefghij"), 0, SV("12345"), 0, 5, S("12345abcdefghij")); + + return true; } template -void test12() +TEST_CONSTEXPR_CXX20 bool test12() { test(S("abcdefghij"), 0, SV("12345"), 0, 6, S("12345abcdefghij")); test(S("abcdefghij"), 0, SV("12345"), 1, 0, S("abcdefghij")); @@ -795,10 +819,12 @@ test(S("abcdefghij"), 0, SV("12345678901234567890"), 0, 21, S("12345678901234567890abcdefghij")); test(S("abcdefghij"), 0, SV("12345678901234567890"), 1, 0, S("abcdefghij")); test(S("abcdefghij"), 0, SV("12345678901234567890"), 1, 1, S("2abcdefghij")); + + return true; } template -void test13() +TEST_CONSTEXPR_CXX20 bool test13() { test(S("abcdefghij"), 0, SV("12345678901234567890"), 1, 9, S("234567890abcdefghij")); test(S("abcdefghij"), 0, SV("12345678901234567890"), 1, 18, S("234567890123456789abcdefghij")); @@ -850,10 +876,12 @@ test(S("abcdefghij"), 1, SV("1234567890"), 0, 11, S("a1234567890bcdefghij")); test(S("abcdefghij"), 1, SV("1234567890"), 1, 0, S("abcdefghij")); test(S("abcdefghij"), 1, SV("1234567890"), 1, 1, S("a2bcdefghij")); + + return true; } template -void test14() +TEST_CONSTEXPR_CXX20 bool test14() { test(S("abcdefghij"), 1, SV("1234567890"), 1, 4, S("a2345bcdefghij")); test(S("abcdefghij"), 1, SV("1234567890"), 1, 8, S("a23456789bcdefghij")); @@ -905,10 +933,12 @@ test(S("abcdefghij"), 5, SV("12345"), 0, 5, S("abcde12345fghij")); test(S("abcdefghij"), 5, SV("12345"), 0, 6, S("abcde12345fghij")); test(S("abcdefghij"), 5, SV("12345"), 1, 0, S("abcdefghij")); + + return true; } template -void test15() +TEST_CONSTEXPR_CXX20 bool test15() { test(S("abcdefghij"), 5, SV("12345"), 1, 1, S("abcde2fghij")); test(S("abcdefghij"), 5, SV("12345"), 1, 2, S("abcde23fghij")); @@ -960,10 +990,12 @@ test(S("abcdefghij"), 5, SV("12345678901234567890"), 1, 1, S("abcde2fghij")); test(S("abcdefghij"), 5, SV("12345678901234567890"), 1, 9, S("abcde234567890fghij")); test(S("abcdefghij"), 5, SV("12345678901234567890"), 1, 18, S("abcde234567890123456789fghij")); + + return true; } template -void test16() +TEST_CONSTEXPR_CXX20 bool test16() { test(S("abcdefghij"), 5, SV("12345678901234567890"), 1, 19, S("abcde2345678901234567890fghij")); test(S("abcdefghij"), 5, SV("12345678901234567890"), 1, 20, S("abcde2345678901234567890fghij")); @@ -1015,10 +1047,12 @@ test(S("abcdefghij"), 9, SV("1234567890"), 1, 1, S("abcdefghi2j")); test(S("abcdefghij"), 9, SV("1234567890"), 1, 4, S("abcdefghi2345j")); test(S("abcdefghij"), 9, SV("1234567890"), 1, 8, S("abcdefghi23456789j")); + + return true; } template -void test17() +TEST_CONSTEXPR_CXX20 bool test17() { test(S("abcdefghij"), 9, SV("1234567890"), 1, 9, S("abcdefghi234567890j")); test(S("abcdefghij"), 9, SV("1234567890"), 1, 10, S("abcdefghi234567890j")); @@ -1070,10 +1104,12 @@ test(S("abcdefghij"), 10, SV("12345"), 1, 0, S("abcdefghij")); test(S("abcdefghij"), 10, SV("12345"), 1, 1, S("abcdefghij2")); test(S("abcdefghij"), 10, SV("12345"), 1, 2, S("abcdefghij23")); + + return true; } template -void test18() +TEST_CONSTEXPR_CXX20 bool test18() { test(S("abcdefghij"), 10, SV("12345"), 1, 3, S("abcdefghij234")); test(S("abcdefghij"), 10, SV("12345"), 1, 4, S("abcdefghij2345")); @@ -1125,10 +1161,12 @@ test(S("abcdefghij"), 10, SV("12345678901234567890"), 1, 18, S("abcdefghij234567890123456789")); test(S("abcdefghij"), 10, SV("12345678901234567890"), 1, 19, S("abcdefghij2345678901234567890")); test(S("abcdefghij"), 10, SV("12345678901234567890"), 1, 20, S("abcdefghij2345678901234567890")); + + return true; } template -void test19() +TEST_CONSTEXPR_CXX20 bool test19() { test(S("abcdefghij"), 10, SV("12345678901234567890"), 10, 0, S("abcdefghij")); test(S("abcdefghij"), 10, SV("12345678901234567890"), 10, 1, S("abcdefghij1")); @@ -1180,10 +1218,12 @@ test(S("abcdefghij"), 11, SV("1234567890"), 1, 8, S("can't happen")); test(S("abcdefghij"), 11, SV("1234567890"), 1, 9, S("can't happen")); test(S("abcdefghij"), 11, SV("1234567890"), 1, 10, S("can't happen")); + + return true; } template -void test20() +TEST_CONSTEXPR_CXX20 bool test20() { test(S("abcdefghij"), 11, SV("1234567890"), 5, 0, S("can't happen")); test(S("abcdefghij"), 11, SV("1234567890"), 5, 1, S("can't happen")); @@ -1235,10 +1275,12 @@ test(S("abcdefghijklmnopqrst"), 0, SV("12345"), 1, 2, S("23abcdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 0, SV("12345"), 1, 3, S("234abcdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 0, SV("12345"), 1, 4, S("2345abcdefghijklmnopqrst")); + + return true; } template -void test21() +TEST_CONSTEXPR_CXX20 bool test21() { test(S("abcdefghijklmnopqrst"), 0, SV("12345"), 1, 5, S("2345abcdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 0, SV("12345"), 2, 0, S("abcdefghijklmnopqrst")); @@ -1290,10 +1332,12 @@ test(S("abcdefghijklmnopqrst"), 0, SV("12345678901234567890"), 1, 20, S("2345678901234567890abcdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 0, SV("12345678901234567890"), 10, 0, S("abcdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 0, SV("12345678901234567890"), 10, 1, S("1abcdefghijklmnopqrst")); + + return true; } template -void test22() +TEST_CONSTEXPR_CXX20 bool test22() { test(S("abcdefghijklmnopqrst"), 0, SV("12345678901234567890"), 10, 5, S("12345abcdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 0, SV("12345678901234567890"), 10, 9, S("123456789abcdefghijklmnopqrst")); @@ -1345,10 +1389,12 @@ test(S("abcdefghijklmnopqrst"), 1, SV("1234567890"), 1, 10, S("a234567890bcdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 1, SV("1234567890"), 5, 0, S("abcdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 1, SV("1234567890"), 5, 1, S("a6bcdefghijklmnopqrst")); + + return true; } template -void test23() +TEST_CONSTEXPR_CXX20 bool test23() { test(S("abcdefghijklmnopqrst"), 1, SV("1234567890"), 5, 2, S("a67bcdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 1, SV("1234567890"), 5, 4, S("a6789bcdefghijklmnopqrst")); @@ -1400,10 +1446,12 @@ test(S("abcdefghijklmnopqrst"), 10, SV("12345"), 1, 4, S("abcdefghij2345klmnopqrst")); test(S("abcdefghijklmnopqrst"), 10, SV("12345"), 1, 5, S("abcdefghij2345klmnopqrst")); test(S("abcdefghijklmnopqrst"), 10, SV("12345"), 2, 0, S("abcdefghijklmnopqrst")); + + return true; } template -void test24() +TEST_CONSTEXPR_CXX20 bool test24() { test(S("abcdefghijklmnopqrst"), 10, SV("12345"), 2, 1, S("abcdefghij3klmnopqrst")); test(S("abcdefghijklmnopqrst"), 10, SV("12345"), 2, 2, S("abcdefghij34klmnopqrst")); @@ -1455,10 +1503,12 @@ test(S("abcdefghijklmnopqrst"), 10, SV("12345678901234567890"), 10, 1, S("abcdefghij1klmnopqrst")); test(S("abcdefghijklmnopqrst"), 10, SV("12345678901234567890"), 10, 5, S("abcdefghij12345klmnopqrst")); test(S("abcdefghijklmnopqrst"), 10, SV("12345678901234567890"), 10, 9, S("abcdefghij123456789klmnopqrst")); + + return true; } template -void test25() +TEST_CONSTEXPR_CXX20 bool test25() { test(S("abcdefghijklmnopqrst"), 10, SV("12345678901234567890"), 10, 10, S("abcdefghij1234567890klmnopqrst")); test(S("abcdefghijklmnopqrst"), 10, SV("12345678901234567890"), 10, 11, S("abcdefghij1234567890klmnopqrst")); @@ -1510,10 +1560,12 @@ test(S("abcdefghijklmnopqrst"), 19, SV("1234567890"), 5, 1, S("abcdefghijklmnopqrs6t")); test(S("abcdefghijklmnopqrst"), 19, SV("1234567890"), 5, 2, S("abcdefghijklmnopqrs67t")); test(S("abcdefghijklmnopqrst"), 19, SV("1234567890"), 5, 4, S("abcdefghijklmnopqrs6789t")); + + return true; } template -void test26() +TEST_CONSTEXPR_CXX20 bool test26() { test(S("abcdefghijklmnopqrst"), 19, SV("1234567890"), 5, 5, S("abcdefghijklmnopqrs67890t")); test(S("abcdefghijklmnopqrst"), 19, SV("1234567890"), 5, 6, S("abcdefghijklmnopqrs67890t")); @@ -1565,10 +1617,12 @@ test(S("abcdefghijklmnopqrst"), 20, SV("12345"), 2, 0, S("abcdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 20, SV("12345"), 2, 1, S("abcdefghijklmnopqrst3")); test(S("abcdefghijklmnopqrst"), 20, SV("12345"), 2, 2, S("abcdefghijklmnopqrst34")); + + return true; } template -void test27() +TEST_CONSTEXPR_CXX20 bool test27() { test(S("abcdefghijklmnopqrst"), 20, SV("12345"), 2, 3, S("abcdefghijklmnopqrst345")); test(S("abcdefghijklmnopqrst"), 20, SV("12345"), 2, 4, S("abcdefghijklmnopqrst345")); @@ -1620,10 +1674,12 @@ test(S("abcdefghijklmnopqrst"), 20, SV("12345678901234567890"), 10, 9, S("abcdefghijklmnopqrst123456789")); test(S("abcdefghijklmnopqrst"), 20, SV("12345678901234567890"), 10, 10, S("abcdefghijklmnopqrst1234567890")); test(S("abcdefghijklmnopqrst"), 20, SV("12345678901234567890"), 10, 11, S("abcdefghijklmnopqrst1234567890")); + + return true; } template -void test28() +TEST_CONSTEXPR_CXX20 bool test28() { test(S("abcdefghijklmnopqrst"), 20, SV("12345678901234567890"), 19, 0, S("abcdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 20, SV("12345678901234567890"), 19, 1, S("abcdefghijklmnopqrst0")); @@ -1675,10 +1731,12 @@ test(S("abcdefghijklmnopqrst"), 21, SV("1234567890"), 5, 4, S("can't happen")); test(S("abcdefghijklmnopqrst"), 21, SV("1234567890"), 5, 5, S("can't happen")); test(S("abcdefghijklmnopqrst"), 21, SV("1234567890"), 5, 6, S("can't happen")); + + return true; } template -void test29() +TEST_CONSTEXPR_CXX20 bool test29() { test(S("abcdefghijklmnopqrst"), 21, SV("1234567890"), 9, 0, S("can't happen")); test(S("abcdefghijklmnopqrst"), 21, SV("1234567890"), 9, 1, S("can't happen")); @@ -1710,10 +1768,12 @@ test(S("abcdefghijklmnopqrst"), 21, SV("12345678901234567890"), 20, 0, S("can't happen")); test(S("abcdefghijklmnopqrst"), 21, SV("12345678901234567890"), 20, 1, S("can't happen")); test(S("abcdefghijklmnopqrst"), 21, SV("12345678901234567890"), 21, 0, S("can't happen")); + + return true; } template -void test30() +TEST_CONSTEXPR_CXX20 bool test30() { test_npos(S(""), 0, SV("12345678901234567890"), 0, S("12345678901234567890")); test_npos(S(""), 0, SV("12345678901234567890"), 1, S( "2345678901234567890")); @@ -1727,85 +1787,12 @@ test_npos(S("abcdefghijklmnopqrst"), 10, SV("12345"), 3, S("abcdefghij45klmnopqrst")); test_npos(S("abcdefghijklmnopqrst"), 10, SV("12345"), 5, S("abcdefghijklmnopqrst")); test_npos(S("abcdefghijklmnopqrst"), 10, SV("12345"), 6, S("can't happen")); + + return true; } -int main(int, char**) -{ - { - typedef std::string S; - typedef std::string_view SV; - test0(); - test1(); - test2(); - test3(); - test4(); - test5(); - test6(); - test7(); - test8(); - test9(); - test10(); - test11(); - test12(); - test13(); - test14(); - test15(); - test16(); - test17(); - test18(); - test19(); - test20(); - test21(); - test22(); - test23(); - test24(); - test25(); - test26(); - test27(); - test28(); - test29(); - test30(); - } -#if TEST_STD_VER >= 11 - { - typedef std::basic_string, min_allocator> S; - typedef std::basic_string_view> SV; - test0(); - test1(); - test2(); - test3(); - test4(); - test5(); - test6(); - test7(); - test8(); - test9(); - test10(); - test11(); - test12(); - test13(); - test14(); - test15(); - test16(); - test17(); - test18(); - test19(); - test20(); - test21(); - test22(); - test23(); - test24(); - test25(); - test26(); - test27(); - test28(); - test29(); - test30(); - } -#endif - { - typedef std::string S; - typedef std::string_view SV; +template +bool test31() { S s; SV sv = "EFGH"; char arr[] = "IJKL"; @@ -1837,7 +1824,88 @@ s.insert(0, arr, 0); // calls insert(const char *, len) assert(s == ""); s.clear(); - } + + return true; +} + +template +void test() { + test0(); + test1(); + test2(); + test3(); + test4(); + test5(); + test6(); + test7(); + test8(); + test9(); + test10(); + test11(); + test12(); + test13(); + test14(); + test15(); + test16(); + test17(); + test18(); + test19(); + test20(); + test21(); + test22(); + test23(); + test24(); + test25(); + test26(); + test27(); + test28(); + test29(); + test30(); + test31(); + +#if TEST_STD_VER > 17 + // static_assert(test0()); + // static_assert(test1()); + // static_assert(test2()); + // static_assert(test3()); + // static_assert(test4()); + // static_assert(test5()); + // static_assert(test6()); + // static_assert(test7()); + // static_assert(test8()); + // static_assert(test9()); + // static_assert(test10()); + // static_assert(test11()); + // static_assert(test12()); + // static_assert(test13()); + // static_assert(test14()); + // static_assert(test15()); + // static_assert(test16()); + // static_assert(test17()); + // static_assert(test18()); + // static_assert(test19()); + // static_assert(test20()); + // static_assert(test21()); + // static_assert(test22()); + // static_assert(test23()); + // static_assert(test24()); + // static_assert(test25()); + // static_assert(test26()); + // static_assert(test27()); + // static_assert(test28()); + // static_assert(test29()); + // static_assert(test30()); + // static_assert(test31()); +#endif +} + +int main(int, char**) +{ + test(); +#if TEST_STD_VER >= 11 + test, min_allocator>, + std::basic_string_view>>(); +#endif return 0; } diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_pointer.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_pointer.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_pointer.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_pointer.pass.cpp @@ -19,7 +19,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(S s, typename S::size_type pos, const typename S::value_type* str, S expected) { const typename S::size_type old_size = s.size(); @@ -47,9 +47,8 @@ #endif } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; test(S(""), 0, "", S("")); test(S(""), 0, "12345", S("12345")); @@ -131,9 +130,9 @@ test(S("abcdefghijklmnopqrst"), 21, "12345", S("can't happen")); test(S("abcdefghijklmnopqrst"), 21, "1234567890", S("can't happen")); test(S("abcdefghijklmnopqrst"), 21, "12345678901234567890", S("can't happen")); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; test(S(""), 0, "", S("")); test(S(""), 0, "12345", S("12345")); @@ -215,10 +214,10 @@ test(S("abcdefghijklmnopqrst"), 21, "12345", S("can't happen")); test(S("abcdefghijklmnopqrst"), 21, "1234567890", S("can't happen")); test(S("abcdefghijklmnopqrst"), 21, "12345678901234567890", S("can't happen")); - } + } #endif - { // test inserting into self + { // test inserting into self typedef std::string S; S s_short = "123/"; S s_long = "Lorem ipsum dolor sit amet, consectetur/"; @@ -232,7 +231,17 @@ s_long.insert(0, 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; } diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_pointer_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_pointer_size.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_pointer_size.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_pointer_size.pass.cpp @@ -19,7 +19,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(S s, typename S::size_type pos, const typename S::value_type* str, typename S::size_type n, S expected) { @@ -48,9 +48,8 @@ #endif } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; test(S(""), 0, "", 0, S("")); test(S(""), 0, "12345", 0, S("")); @@ -372,9 +371,9 @@ test(S("abcdefghijklmnopqrst"), 21, "12345678901234567890", 10, S("can't happen")); test(S("abcdefghijklmnopqrst"), 21, "12345678901234567890", 19, S("can't happen")); test(S("abcdefghijklmnopqrst"), 21, "12345678901234567890", 20, S("can't happen")); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; test(S(""), 0, "", 0, S("")); test(S(""), 0, "12345", 0, S("")); @@ -696,10 +695,10 @@ test(S("abcdefghijklmnopqrst"), 21, "12345678901234567890", 10, S("can't happen")); test(S("abcdefghijklmnopqrst"), 21, "12345678901234567890", 19, S("can't happen")); test(S("abcdefghijklmnopqrst"), 21, "12345678901234567890", 20, S("can't happen")); - } + } #endif - { // test inserting into self + { // test inserting into self typedef std::string S; S s_short = "123/"; S s_long = "Lorem ipsum dolor sit amet, consectetur/"; @@ -713,7 +712,17 @@ s_long.insert(0, s_long.data(), s_long.size()); 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; } diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_size_char.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_size_char.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_size_char.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_size_char.pass.cpp @@ -19,7 +19,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(S s, typename S::size_type pos, typename S::size_type n, typename S::value_type str, S expected) { @@ -48,9 +48,8 @@ #endif } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; test(S(""), 0, 0, '1', S("")); test(S(""), 0, 5, '1', S("11111")); @@ -132,9 +131,9 @@ test(S("abcdefghijklmnopqrst"), 21, 5, '1', S("can't happen")); test(S("abcdefghijklmnopqrst"), 21, 10, '1', S("can't happen")); test(S("abcdefghijklmnopqrst"), 21, 20, '1', S("can't happen")); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; test(S(""), 0, 0, '1', S("")); test(S(""), 0, 5, '1', S("11111")); @@ -216,7 +215,17 @@ test(S("abcdefghijklmnopqrst"), 21, 5, '1', S("can't happen")); test(S("abcdefghijklmnopqrst"), 21, 10, '1', S("can't happen")); test(S("abcdefghijklmnopqrst"), 21, 20, '1', S("can't happen")); - } + } +#endif + + return true; +} + +int main(int, char**) +{ + test(); +#if TEST_STD_VER > 17 + // static_assert(test()); #endif return 0; diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_string.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_string.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_string.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_string.pass.cpp @@ -19,7 +19,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(S s, typename S::size_type pos, S str, S expected) { const typename S::size_type old_size = s.size(); @@ -47,9 +47,8 @@ #endif } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; test(S(""), 0, S(""), S("")); test(S(""), 0, S("12345"), S("12345")); @@ -131,9 +130,9 @@ test(S("abcdefghijklmnopqrst"), 21, S("12345"), S("can't happen")); test(S("abcdefghijklmnopqrst"), 21, S("1234567890"), S("can't happen")); test(S("abcdefghijklmnopqrst"), 21, S("12345678901234567890"), S("can't happen")); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; test(S(""), 0, S(""), S("")); test(S(""), 0, S("12345"), S("12345")); @@ -215,16 +214,26 @@ test(S("abcdefghijklmnopqrst"), 21, S("12345"), S("can't happen")); test(S("abcdefghijklmnopqrst"), 21, S("1234567890"), S("can't happen")); test(S("abcdefghijklmnopqrst"), 21, S("12345678901234567890"), S("can't happen")); - } + } #endif #if TEST_STD_VER > 3 - { // LWG 2946 + { // LWG 2946 std::string s; s.insert(0, {"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; diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_string_size_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_string_size_size.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_string_size_size.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_string_size_size.pass.cpp @@ -21,7 +21,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(S s, typename S::size_type pos1, S str, typename S::size_type pos2, typename S::size_type n, S expected) { @@ -51,7 +51,7 @@ } template -void +TEST_CONSTEXPR_CXX20 void test_npos(S s, typename S::size_type pos1, S str, typename S::size_type pos2, S expected) { const typename S::size_type old_size = s.size(); @@ -81,7 +81,7 @@ template -void test0() +TEST_CONSTEXPR_CXX20 bool test0() { test(S(""), 0, S(""), 0, 0, S("")); test(S(""), 0, S(""), 0, 1, S("")); @@ -133,10 +133,12 @@ test(S(""), 0, S("1234567890"), 10, 0, S("")); test(S(""), 0, S("1234567890"), 10, 1, S("")); test(S(""), 0, S("1234567890"), 11, 0, S("can't happen")); + + return true; } template -void test1() +TEST_CONSTEXPR_CXX20 bool test1() { test(S(""), 0, S("12345678901234567890"), 0, 0, S("")); test(S(""), 0, S("12345678901234567890"), 0, 1, S("1")); @@ -188,10 +190,12 @@ test(S(""), 1, S("12345"), 5, 0, S("can't happen")); test(S(""), 1, S("12345"), 5, 1, S("can't happen")); test(S(""), 1, S("12345"), 6, 0, S("can't happen")); + + return true; } template -void test2() +TEST_CONSTEXPR_CXX20 bool test2() { test(S(""), 1, S("1234567890"), 0, 0, S("can't happen")); test(S(""), 1, S("1234567890"), 0, 1, S("can't happen")); @@ -243,10 +247,12 @@ test(S(""), 1, S("12345678901234567890"), 21, 0, S("can't happen")); test(S("abcde"), 0, S(""), 0, 0, S("abcde")); test(S("abcde"), 0, S(""), 0, 1, S("abcde")); + + return true; } template -void test3() +TEST_CONSTEXPR_CXX20 bool test3() { test(S("abcde"), 0, S(""), 1, 0, S("can't happen")); test(S("abcde"), 0, S("12345"), 0, 0, S("abcde")); @@ -298,10 +304,12 @@ test(S("abcde"), 0, S("1234567890"), 11, 0, S("can't happen")); test(S("abcde"), 0, S("12345678901234567890"), 0, 0, S("abcde")); test(S("abcde"), 0, S("12345678901234567890"), 0, 1, S("1abcde")); + + return true; } template -void test4() +TEST_CONSTEXPR_CXX20 bool test4() { test(S("abcde"), 0, S("12345678901234567890"), 0, 10, S("1234567890abcde")); test(S("abcde"), 0, S("12345678901234567890"), 0, 19, S("1234567890123456789abcde")); @@ -353,10 +361,12 @@ test(S("abcde"), 1, S("12345"), 6, 0, S("can't happen")); test(S("abcde"), 1, S("1234567890"), 0, 0, S("abcde")); test(S("abcde"), 1, S("1234567890"), 0, 1, S("a1bcde")); + + return true; } template -void test5() +TEST_CONSTEXPR_CXX20 bool test5() { test(S("abcde"), 1, S("1234567890"), 0, 5, S("a12345bcde")); test(S("abcde"), 1, S("1234567890"), 0, 9, S("a123456789bcde")); @@ -408,10 +418,12 @@ test(S("abcde"), 2, S(""), 0, 1, S("abcde")); test(S("abcde"), 2, S(""), 1, 0, S("can't happen")); test(S("abcde"), 2, S("12345"), 0, 0, S("abcde")); + + return true; } template -void test6() +TEST_CONSTEXPR_CXX20 bool test6() { test(S("abcde"), 2, S("12345"), 0, 1, S("ab1cde")); test(S("abcde"), 2, S("12345"), 0, 2, S("ab12cde")); @@ -463,10 +475,12 @@ test(S("abcde"), 2, S("12345678901234567890"), 0, 1, S("ab1cde")); test(S("abcde"), 2, S("12345678901234567890"), 0, 10, S("ab1234567890cde")); test(S("abcde"), 2, S("12345678901234567890"), 0, 19, S("ab1234567890123456789cde")); + + return true; } template -void test7() +TEST_CONSTEXPR_CXX20 bool test7() { test(S("abcde"), 2, S("12345678901234567890"), 0, 20, S("ab12345678901234567890cde")); test(S("abcde"), 2, S("12345678901234567890"), 0, 21, S("ab12345678901234567890cde")); @@ -518,10 +532,12 @@ test(S("abcde"), 4, S("1234567890"), 0, 1, S("abcd1e")); test(S("abcde"), 4, S("1234567890"), 0, 5, S("abcd12345e")); test(S("abcde"), 4, S("1234567890"), 0, 9, S("abcd123456789e")); + + return true; } template -void test8() +TEST_CONSTEXPR_CXX20 bool test8() { test(S("abcde"), 4, S("1234567890"), 0, 10, S("abcd1234567890e")); test(S("abcde"), 4, S("1234567890"), 0, 11, S("abcd1234567890e")); @@ -573,10 +589,12 @@ test(S("abcde"), 5, S("12345"), 0, 0, S("abcde")); test(S("abcde"), 5, S("12345"), 0, 1, S("abcde1")); test(S("abcde"), 5, S("12345"), 0, 2, S("abcde12")); + + return true; } template -void test9() +TEST_CONSTEXPR_CXX20 bool test9() { test(S("abcde"), 5, S("12345"), 0, 4, S("abcde1234")); test(S("abcde"), 5, S("12345"), 0, 5, S("abcde12345")); @@ -628,10 +646,12 @@ test(S("abcde"), 5, S("12345678901234567890"), 0, 19, S("abcde1234567890123456789")); test(S("abcde"), 5, S("12345678901234567890"), 0, 20, S("abcde12345678901234567890")); test(S("abcde"), 5, S("12345678901234567890"), 0, 21, S("abcde12345678901234567890")); + + return true; } template -void test10() +TEST_CONSTEXPR_CXX20 bool test10() { test(S("abcde"), 5, S("12345678901234567890"), 1, 0, S("abcde")); test(S("abcde"), 5, S("12345678901234567890"), 1, 1, S("abcde2")); @@ -683,10 +703,12 @@ test(S("abcde"), 6, S("1234567890"), 0, 9, S("can't happen")); test(S("abcde"), 6, S("1234567890"), 0, 10, S("can't happen")); test(S("abcde"), 6, S("1234567890"), 0, 11, S("can't happen")); + + return true; } template -void test11() +TEST_CONSTEXPR_CXX20 bool test11() { test(S("abcde"), 6, S("1234567890"), 1, 0, S("can't happen")); test(S("abcde"), 6, S("1234567890"), 1, 1, S("can't happen")); @@ -738,10 +760,12 @@ test(S("abcdefghij"), 0, S("12345"), 0, 2, S("12abcdefghij")); test(S("abcdefghij"), 0, S("12345"), 0, 4, S("1234abcdefghij")); test(S("abcdefghij"), 0, S("12345"), 0, 5, S("12345abcdefghij")); + + return true; } template -void test12() +TEST_CONSTEXPR_CXX20 bool test12() { test(S("abcdefghij"), 0, S("12345"), 0, 6, S("12345abcdefghij")); test(S("abcdefghij"), 0, S("12345"), 1, 0, S("abcdefghij")); @@ -793,10 +817,12 @@ test(S("abcdefghij"), 0, S("12345678901234567890"), 0, 21, S("12345678901234567890abcdefghij")); test(S("abcdefghij"), 0, S("12345678901234567890"), 1, 0, S("abcdefghij")); test(S("abcdefghij"), 0, S("12345678901234567890"), 1, 1, S("2abcdefghij")); + + return true; } template -void test13() +TEST_CONSTEXPR_CXX20 bool test13() { test(S("abcdefghij"), 0, S("12345678901234567890"), 1, 9, S("234567890abcdefghij")); test(S("abcdefghij"), 0, S("12345678901234567890"), 1, 18, S("234567890123456789abcdefghij")); @@ -848,10 +874,12 @@ test(S("abcdefghij"), 1, S("1234567890"), 0, 11, S("a1234567890bcdefghij")); test(S("abcdefghij"), 1, S("1234567890"), 1, 0, S("abcdefghij")); test(S("abcdefghij"), 1, S("1234567890"), 1, 1, S("a2bcdefghij")); + + return true; } template -void test14() +TEST_CONSTEXPR_CXX20 bool test14() { test(S("abcdefghij"), 1, S("1234567890"), 1, 4, S("a2345bcdefghij")); test(S("abcdefghij"), 1, S("1234567890"), 1, 8, S("a23456789bcdefghij")); @@ -903,10 +931,12 @@ test(S("abcdefghij"), 5, S("12345"), 0, 5, S("abcde12345fghij")); test(S("abcdefghij"), 5, S("12345"), 0, 6, S("abcde12345fghij")); test(S("abcdefghij"), 5, S("12345"), 1, 0, S("abcdefghij")); + + return true; } template -void test15() +TEST_CONSTEXPR_CXX20 bool test15() { test(S("abcdefghij"), 5, S("12345"), 1, 1, S("abcde2fghij")); test(S("abcdefghij"), 5, S("12345"), 1, 2, S("abcde23fghij")); @@ -958,10 +988,12 @@ test(S("abcdefghij"), 5, S("12345678901234567890"), 1, 1, S("abcde2fghij")); test(S("abcdefghij"), 5, S("12345678901234567890"), 1, 9, S("abcde234567890fghij")); test(S("abcdefghij"), 5, S("12345678901234567890"), 1, 18, S("abcde234567890123456789fghij")); + + return true; } template -void test16() +TEST_CONSTEXPR_CXX20 bool test16() { test(S("abcdefghij"), 5, S("12345678901234567890"), 1, 19, S("abcde2345678901234567890fghij")); test(S("abcdefghij"), 5, S("12345678901234567890"), 1, 20, S("abcde2345678901234567890fghij")); @@ -1013,10 +1045,12 @@ test(S("abcdefghij"), 9, S("1234567890"), 1, 1, S("abcdefghi2j")); test(S("abcdefghij"), 9, S("1234567890"), 1, 4, S("abcdefghi2345j")); test(S("abcdefghij"), 9, S("1234567890"), 1, 8, S("abcdefghi23456789j")); + + return true; } template -void test17() +TEST_CONSTEXPR_CXX20 bool test17() { test(S("abcdefghij"), 9, S("1234567890"), 1, 9, S("abcdefghi234567890j")); test(S("abcdefghij"), 9, S("1234567890"), 1, 10, S("abcdefghi234567890j")); @@ -1068,10 +1102,12 @@ test(S("abcdefghij"), 10, S("12345"), 1, 0, S("abcdefghij")); test(S("abcdefghij"), 10, S("12345"), 1, 1, S("abcdefghij2")); test(S("abcdefghij"), 10, S("12345"), 1, 2, S("abcdefghij23")); + + return true; } template -void test18() +TEST_CONSTEXPR_CXX20 bool test18() { test(S("abcdefghij"), 10, S("12345"), 1, 3, S("abcdefghij234")); test(S("abcdefghij"), 10, S("12345"), 1, 4, S("abcdefghij2345")); @@ -1123,10 +1159,12 @@ test(S("abcdefghij"), 10, S("12345678901234567890"), 1, 18, S("abcdefghij234567890123456789")); test(S("abcdefghij"), 10, S("12345678901234567890"), 1, 19, S("abcdefghij2345678901234567890")); test(S("abcdefghij"), 10, S("12345678901234567890"), 1, 20, S("abcdefghij2345678901234567890")); + + return true; } template -void test19() +TEST_CONSTEXPR_CXX20 bool test19() { test(S("abcdefghij"), 10, S("12345678901234567890"), 10, 0, S("abcdefghij")); test(S("abcdefghij"), 10, S("12345678901234567890"), 10, 1, S("abcdefghij1")); @@ -1178,10 +1216,12 @@ test(S("abcdefghij"), 11, S("1234567890"), 1, 8, S("can't happen")); test(S("abcdefghij"), 11, S("1234567890"), 1, 9, S("can't happen")); test(S("abcdefghij"), 11, S("1234567890"), 1, 10, S("can't happen")); + + return true; } template -void test20() +TEST_CONSTEXPR_CXX20 bool test20() { test(S("abcdefghij"), 11, S("1234567890"), 5, 0, S("can't happen")); test(S("abcdefghij"), 11, S("1234567890"), 5, 1, S("can't happen")); @@ -1233,10 +1273,12 @@ test(S("abcdefghijklmnopqrst"), 0, S("12345"), 1, 2, S("23abcdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 0, S("12345"), 1, 3, S("234abcdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 0, S("12345"), 1, 4, S("2345abcdefghijklmnopqrst")); + + return true; } template -void test21() +TEST_CONSTEXPR_CXX20 bool test21() { test(S("abcdefghijklmnopqrst"), 0, S("12345"), 1, 5, S("2345abcdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 0, S("12345"), 2, 0, S("abcdefghijklmnopqrst")); @@ -1288,10 +1330,12 @@ test(S("abcdefghijklmnopqrst"), 0, S("12345678901234567890"), 1, 20, S("2345678901234567890abcdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 0, S("12345678901234567890"), 10, 0, S("abcdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 0, S("12345678901234567890"), 10, 1, S("1abcdefghijklmnopqrst")); + + return true; } template -void test22() +TEST_CONSTEXPR_CXX20 bool test22() { test(S("abcdefghijklmnopqrst"), 0, S("12345678901234567890"), 10, 5, S("12345abcdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 0, S("12345678901234567890"), 10, 9, S("123456789abcdefghijklmnopqrst")); @@ -1343,10 +1387,12 @@ test(S("abcdefghijklmnopqrst"), 1, S("1234567890"), 1, 10, S("a234567890bcdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 1, S("1234567890"), 5, 0, S("abcdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 1, S("1234567890"), 5, 1, S("a6bcdefghijklmnopqrst")); + + return true; } template -void test23() +TEST_CONSTEXPR_CXX20 bool test23() { test(S("abcdefghijklmnopqrst"), 1, S("1234567890"), 5, 2, S("a67bcdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 1, S("1234567890"), 5, 4, S("a6789bcdefghijklmnopqrst")); @@ -1398,10 +1444,12 @@ test(S("abcdefghijklmnopqrst"), 10, S("12345"), 1, 4, S("abcdefghij2345klmnopqrst")); test(S("abcdefghijklmnopqrst"), 10, S("12345"), 1, 5, S("abcdefghij2345klmnopqrst")); test(S("abcdefghijklmnopqrst"), 10, S("12345"), 2, 0, S("abcdefghijklmnopqrst")); + + return true; } template -void test24() +TEST_CONSTEXPR_CXX20 bool test24() { test(S("abcdefghijklmnopqrst"), 10, S("12345"), 2, 1, S("abcdefghij3klmnopqrst")); test(S("abcdefghijklmnopqrst"), 10, S("12345"), 2, 2, S("abcdefghij34klmnopqrst")); @@ -1453,10 +1501,12 @@ test(S("abcdefghijklmnopqrst"), 10, S("12345678901234567890"), 10, 1, S("abcdefghij1klmnopqrst")); test(S("abcdefghijklmnopqrst"), 10, S("12345678901234567890"), 10, 5, S("abcdefghij12345klmnopqrst")); test(S("abcdefghijklmnopqrst"), 10, S("12345678901234567890"), 10, 9, S("abcdefghij123456789klmnopqrst")); + + return true; } template -void test25() +TEST_CONSTEXPR_CXX20 bool test25() { test(S("abcdefghijklmnopqrst"), 10, S("12345678901234567890"), 10, 10, S("abcdefghij1234567890klmnopqrst")); test(S("abcdefghijklmnopqrst"), 10, S("12345678901234567890"), 10, 11, S("abcdefghij1234567890klmnopqrst")); @@ -1508,10 +1558,12 @@ test(S("abcdefghijklmnopqrst"), 19, S("1234567890"), 5, 1, S("abcdefghijklmnopqrs6t")); test(S("abcdefghijklmnopqrst"), 19, S("1234567890"), 5, 2, S("abcdefghijklmnopqrs67t")); test(S("abcdefghijklmnopqrst"), 19, S("1234567890"), 5, 4, S("abcdefghijklmnopqrs6789t")); + + return true; } template -void test26() +TEST_CONSTEXPR_CXX20 bool test26() { test(S("abcdefghijklmnopqrst"), 19, S("1234567890"), 5, 5, S("abcdefghijklmnopqrs67890t")); test(S("abcdefghijklmnopqrst"), 19, S("1234567890"), 5, 6, S("abcdefghijklmnopqrs67890t")); @@ -1563,10 +1615,12 @@ test(S("abcdefghijklmnopqrst"), 20, S("12345"), 2, 0, S("abcdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 20, S("12345"), 2, 1, S("abcdefghijklmnopqrst3")); test(S("abcdefghijklmnopqrst"), 20, S("12345"), 2, 2, S("abcdefghijklmnopqrst34")); + + return true; } template -void test27() +TEST_CONSTEXPR_CXX20 bool test27() { test(S("abcdefghijklmnopqrst"), 20, S("12345"), 2, 3, S("abcdefghijklmnopqrst345")); test(S("abcdefghijklmnopqrst"), 20, S("12345"), 2, 4, S("abcdefghijklmnopqrst345")); @@ -1618,10 +1672,12 @@ test(S("abcdefghijklmnopqrst"), 20, S("12345678901234567890"), 10, 9, S("abcdefghijklmnopqrst123456789")); test(S("abcdefghijklmnopqrst"), 20, S("12345678901234567890"), 10, 10, S("abcdefghijklmnopqrst1234567890")); test(S("abcdefghijklmnopqrst"), 20, S("12345678901234567890"), 10, 11, S("abcdefghijklmnopqrst1234567890")); + + return true; } template -void test28() +TEST_CONSTEXPR_CXX20 bool test28() { test(S("abcdefghijklmnopqrst"), 20, S("12345678901234567890"), 19, 0, S("abcdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 20, S("12345678901234567890"), 19, 1, S("abcdefghijklmnopqrst0")); @@ -1673,10 +1729,12 @@ test(S("abcdefghijklmnopqrst"), 21, S("1234567890"), 5, 4, S("can't happen")); test(S("abcdefghijklmnopqrst"), 21, S("1234567890"), 5, 5, S("can't happen")); test(S("abcdefghijklmnopqrst"), 21, S("1234567890"), 5, 6, S("can't happen")); + + return true; } template -void test29() +TEST_CONSTEXPR_CXX20 bool test29() { test(S("abcdefghijklmnopqrst"), 21, S("1234567890"), 9, 0, S("can't happen")); test(S("abcdefghijklmnopqrst"), 21, S("1234567890"), 9, 1, S("can't happen")); @@ -1708,10 +1766,12 @@ test(S("abcdefghijklmnopqrst"), 21, S("12345678901234567890"), 20, 0, S("can't happen")); test(S("abcdefghijklmnopqrst"), 21, S("12345678901234567890"), 20, 1, S("can't happen")); test(S("abcdefghijklmnopqrst"), 21, S("12345678901234567890"), 21, 0, S("can't happen")); + + return true; } template -void test30() +TEST_CONSTEXPR_CXX20 bool test30() { test_npos(S(""), 0, S("12345678901234567890"), 0, S("12345678901234567890")); test_npos(S(""), 0, S("12345678901234567890"), 1, S( "2345678901234567890")); @@ -1725,79 +1785,84 @@ test_npos(S("abcdefghijklmnopqrst"), 10, S("12345"), 3, S("abcdefghij45klmnopqrst")); test_npos(S("abcdefghijklmnopqrst"), 10, S("12345"), 5, S("abcdefghijklmnopqrst")); test_npos(S("abcdefghijklmnopqrst"), 10, S("12345"), 6, S("can't happen")); + + return true; +} + +template +void test() { + test0(); + test1(); + test2(); + test3(); + test4(); + test5(); + test6(); + test7(); + test8(); + test9(); + test10(); + test11(); + test12(); + test13(); + test14(); + test15(); + test16(); + test17(); + test18(); + test19(); + test20(); + test21(); + test22(); + test23(); + test24(); + test25(); + test26(); + test27(); + test28(); + test29(); + test30(); + +#if TEST_STD_VER > 17 + // static_assert(test0()); + // static_assert(test1()); + // static_assert(test2()); + // static_assert(test3()); + // static_assert(test4()); + // static_assert(test5()); + // static_assert(test6()); + // static_assert(test7()); + // static_assert(test8()); + // static_assert(test9()); + // static_assert(test10()); + // static_assert(test11()); + // static_assert(test12()); + // static_assert(test13()); + // static_assert(test14()); + // static_assert(test15()); + // static_assert(test16()); + // static_assert(test17()); + // static_assert(test18()); + // static_assert(test19()); + // static_assert(test20()); + // static_assert(test21()); + // static_assert(test22()); + // static_assert(test23()); + // static_assert(test24()); + // static_assert(test25()); + // static_assert(test26()); + // static_assert(test27()); + // static_assert(test28()); + // static_assert(test29()); + // static_assert(test30()); +#endif } int main(int, char**) { - { - typedef std::string S; - test0(); - test1(); - test2(); - test3(); - test4(); - test5(); - test6(); - test7(); - test8(); - test9(); - test10(); - test11(); - test12(); - test13(); - test14(); - test15(); - test16(); - test17(); - test18(); - test19(); - test20(); - test21(); - test22(); - test23(); - test24(); - test25(); - test26(); - test27(); - test28(); - test29(); - test30(); - } + test(); #if TEST_STD_VER >= 11 - { - typedef std::basic_string, min_allocator> S; - test0(); - test1(); - test2(); - test3(); - test4(); - test5(); - test6(); - test7(); - test8(); - test9(); - test10(); - test11(); - test12(); - test13(); - test14(); - test15(); - test16(); - test17(); - test18(); - test19(); - test20(); - test21(); - test22(); - test23(); - test24(); - test25(); - test26(); - test27(); - test28(); - test29(); - test30(); - } + test, min_allocator>>(); #endif return 0; diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/string_view.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/string_view.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/string_view.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/string_view.pass.cpp @@ -19,7 +19,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(S s, typename S::size_type pos, SV sv, S expected) { const typename S::size_type old_size = s.size(); @@ -47,9 +47,8 @@ #endif } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; typedef std::string_view SV; test(S(""), 0, SV(""), S("")); @@ -132,9 +131,9 @@ test(S("abcdefghijklmnopqrst"), 21, SV("12345"), S("can't happen")); test(S("abcdefghijklmnopqrst"), 21, SV("1234567890"), S("can't happen")); test(S("abcdefghijklmnopqrst"), 21, SV("12345678901234567890"), S("can't happen")); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; typedef std::string_view SV; test(S(""), 0, SV(""), S("")); @@ -217,10 +216,10 @@ test(S("abcdefghijklmnopqrst"), 21, SV("12345"), S("can't happen")); test(S("abcdefghijklmnopqrst"), 21, SV("1234567890"), S("can't happen")); test(S("abcdefghijklmnopqrst"), 21, SV("12345678901234567890"), S("can't happen")); - } + } #endif - { // test inserting into self + { // test inserting into self typedef std::string S; S s_short = "123/"; S s_long = "Lorem ipsum dolor sit amet, consectetur/"; @@ -234,7 +233,17 @@ s_long.insert(0, 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; } diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/char.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/char.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/char.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/char.pass.cpp @@ -17,7 +17,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(S s, typename S::value_type str, S expected) { s += str; @@ -25,23 +25,32 @@ assert(s == expected); } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; test(S(), 'a', S("a")); test(S("12345"), 'a', S("12345a")); test(S("1234567890"), 'a', S("1234567890a")); test(S("12345678901234567890"), 'a', S("12345678901234567890a")); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; test(S(), 'a', S("a")); test(S("12345"), 'a', S("12345a")); test(S("1234567890"), 'a', S("1234567890a")); test(S("12345678901234567890"), 'a', S("12345678901234567890a")); - } + } +#endif + + return true; +} + +int main(int, char**) +{ + test(); +#if TEST_STD_VER > 17 + // static_assert(test()); #endif return 0; diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/initializer_list.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/initializer_list.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/initializer_list.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/initializer_list.pass.cpp @@ -18,19 +18,28 @@ #include "test_macros.h" #include "min_allocator.h" +bool test() { + { + std::string s("123"); + s += {'a', 'b', 'c'}; + assert(s == "123abc"); + } + { + typedef std::basic_string, min_allocator> S; + S s("123"); + s += {'a', 'b', 'c'}; + assert(s == "123abc"); + } + + return true; +} + int main(int, char**) { - { - std::string s("123"); - s += {'a', 'b', 'c'}; - assert(s == "123abc"); - } - { - typedef std::basic_string, min_allocator> S; - S s("123"); - s += {'a', 'b', 'c'}; - assert(s == "123abc"); - } + test(); +#if TEST_STD_VER > 17 + // static_assert(test()); +#endif return 0; } diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/pointer.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/pointer.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/pointer.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/pointer.pass.cpp @@ -17,7 +17,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(S s, const typename S::value_type* str, S expected) { s += str; @@ -25,9 +25,8 @@ assert(s == expected); } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; test(S(), "", S()); test(S(), "12345", S("12345")); @@ -49,9 +48,9 @@ test(S("12345678901234567890"), "1234567890", S("123456789012345678901234567890")); test(S("12345678901234567890"), "12345678901234567890", S("1234567890123456789012345678901234567890")); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; test(S(), "", S()); test(S(), "12345", S("12345")); @@ -73,7 +72,17 @@ test(S("12345678901234567890"), "1234567890", S("123456789012345678901234567890")); test(S("12345678901234567890"), "12345678901234567890", S("1234567890123456789012345678901234567890")); - } + } +#endif + + return true; +} + +int main(int, char**) +{ + test(); +#if TEST_STD_VER > 17 + // static_assert(test()); #endif return 0; diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/string.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/string.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/string.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/string.pass.cpp @@ -18,7 +18,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(S s, S str, S expected) { s += str; @@ -26,9 +26,8 @@ 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 @@ test(S("12345678901234567890"), S("1234567890"), S("123456789012345678901234567890")); test(S("12345678901234567890"), S("12345678901234567890"), S("1234567890123456789012345678901234567890")); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; test(S(), S(), S()); test(S(), S("12345"), S("12345")); @@ -74,16 +73,26 @@ 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 += {"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; diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_initializer_list.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_initializer_list.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_initializer_list.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_initializer_list.pass.cpp @@ -18,19 +18,28 @@ #include "test_macros.h" #include "min_allocator.h" +bool test() { + { + std::string s("123def456"); + s.replace(s.cbegin() + 3, s.cbegin() + 6, {'a', 'b', 'c'}); + assert(s == "123abc456"); + } + { + typedef std::basic_string, min_allocator> S; + S s("123def456"); + s.replace(s.cbegin() + 3, s.cbegin() + 6, {'a', 'b', 'c'}); + assert(s == "123abc456"); + } + + return true; +} + int main(int, char**) { - { - std::string s("123def456"); - s.replace(s.cbegin() + 3, s.cbegin() + 6, {'a', 'b', 'c'}); - assert(s == "123abc456"); - } - { - typedef std::basic_string, min_allocator> S; - S s("123def456"); - s.replace(s.cbegin() + 3, s.cbegin() + 6, {'a', 'b', 'c'}); - assert(s == "123abc456"); - } + test(); +#if TEST_STD_VER > 17 + // static_assert(test()); +#endif return 0; } diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_iter_iter.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_iter_iter.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_iter_iter.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_iter_iter.pass.cpp @@ -21,7 +21,7 @@ #include "test_iterators.h" template -void +TEST_CONSTEXPR_CXX20 void test(S s, typename S::size_type pos1, typename S::size_type n1, It f, It l, S expected) { typename S::size_type old_size = s.size(); @@ -39,7 +39,7 @@ struct Widget { operator char() const { throw 42; } }; template -void +TEST_CONSTEXPR_CXX20 void test_exceptions(S s, typename S::size_type pos1, typename S::size_type n1, It f, It l) { typename S::const_iterator first = s.begin() + pos1; @@ -66,7 +66,7 @@ const char* str = "12345678901234567890"; template -void test0() +TEST_CONSTEXPR_CXX20 bool test0() { test(S(""), 0, 0, str, str+0, S("")); test(S(""), 0, 0, str, str+0, S("")); @@ -168,10 +168,12 @@ test(S("abcde"), 1, 0, str, str+0, S("abcde")); test(S("abcde"), 1, 0, str, str+1, S("a1bcde")); test(S("abcde"), 1, 0, str, str+2, S("a12bcde")); + + return true; } template -void test1() +TEST_CONSTEXPR_CXX20 bool test1() { test(S("abcde"), 1, 0, str, str+4, S("a1234bcde")); test(S("abcde"), 1, 0, str, str+5, S("a12345bcde")); @@ -273,10 +275,12 @@ test(S("abcde"), 2, 1, str, str+5, S("ab12345de")); test(S("abcde"), 2, 1, str, str+0, S("abde")); test(S("abcde"), 2, 1, str, str+1, S("ab1de")); + + return true; } template -void test2() +TEST_CONSTEXPR_CXX20 bool test2() { test(S("abcde"), 2, 1, str, str+5, S("ab12345de")); test(S("abcde"), 2, 1, str, str+9, S("ab123456789de")); @@ -378,10 +382,12 @@ test(S("abcdefghij"), 0, 0, str, str+9, S("123456789abcdefghij")); test(S("abcdefghij"), 0, 0, str, str+10, S("1234567890abcdefghij")); test(S("abcdefghij"), 0, 0, str, str+0, S("abcdefghij")); + + return true; } template -void test3() +TEST_CONSTEXPR_CXX20 bool test3() { test(S("abcdefghij"), 0, 0, str, str+1, S("1abcdefghij")); test(S("abcdefghij"), 0, 0, str, str+10, S("1234567890abcdefghij")); @@ -483,10 +489,12 @@ test(S("abcdefghij"), 1, 1, str, str+10, S("a1234567890cdefghij")); test(S("abcdefghij"), 1, 1, str, str+19, S("a1234567890123456789cdefghij")); test(S("abcdefghij"), 1, 1, str, str+20, S("a12345678901234567890cdefghij")); + + return true; } template -void test4() +TEST_CONSTEXPR_CXX20 bool test4() { test(S("abcdefghij"), 1, 4, str, str+0, S("afghij")); test(S("abcdefghij"), 1, 4, str, str+0, S("afghij")); @@ -588,10 +596,12 @@ test(S("abcdefghij"), 5, 4, str, str+0, S("abcdej")); test(S("abcdefghij"), 5, 4, str, str+1, S("abcde1j")); test(S("abcdefghij"), 5, 4, str, str+2, S("abcde12j")); + + return true; } template -void test5() +TEST_CONSTEXPR_CXX20 bool test5() { test(S("abcdefghij"), 5, 4, str, str+4, S("abcde1234j")); test(S("abcdefghij"), 5, 4, str, str+5, S("abcde12345j")); @@ -693,10 +703,12 @@ test(S("abcdefghijklmnopqrst"), 0, 1, str, str+5, S("12345bcdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 0, 1, str, str+0, S("bcdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 0, 1, str, str+1, S("1bcdefghijklmnopqrst")); + + return true; } template -void test6() +TEST_CONSTEXPR_CXX20 bool test6() { test(S("abcdefghijklmnopqrst"), 0, 1, str, str+5, S("12345bcdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 0, 1, str, str+9, S("123456789bcdefghijklmnopqrst")); @@ -798,10 +810,12 @@ test(S("abcdefghijklmnopqrst"), 1, 9, str, str+9, S("a123456789klmnopqrst")); test(S("abcdefghijklmnopqrst"), 1, 9, str, str+10, S("a1234567890klmnopqrst")); test(S("abcdefghijklmnopqrst"), 1, 9, str, str+0, S("aklmnopqrst")); + + return true; } template -void test7() +TEST_CONSTEXPR_CXX20 bool test7() { test(S("abcdefghijklmnopqrst"), 1, 9, str, str+1, S("a1klmnopqrst")); test(S("abcdefghijklmnopqrst"), 1, 9, str, str+10, S("a1234567890klmnopqrst")); @@ -903,10 +917,12 @@ test(S("abcdefghijklmnopqrst"), 10, 9, str, str+10, S("abcdefghij1234567890t")); test(S("abcdefghijklmnopqrst"), 10, 9, str, str+19, S("abcdefghij1234567890123456789t")); test(S("abcdefghijklmnopqrst"), 10, 9, str, str+20, S("abcdefghij12345678901234567890t")); + + return true; } template -void test8() +TEST_CONSTEXPR_CXX20 bool test8() { test(S("abcdefghijklmnopqrst"), 10, 10, str, str+0, S("abcdefghij")); test(S("abcdefghijklmnopqrst"), 10, 10, str, str+0, S("abcdefghij")); @@ -972,39 +988,14 @@ test(S("abcdefghijklmnopqrst"), 20, 0, str, str+10, S("abcdefghijklmnopqrst1234567890")); test(S("abcdefghijklmnopqrst"), 20, 0, str, str+19, S("abcdefghijklmnopqrst1234567890123456789")); test(S("abcdefghijklmnopqrst"), 20, 0, str, str+20, S("abcdefghijklmnopqrst12345678901234567890")); + + return true; } -int main(int, char**) -{ - { - typedef std::string S; - test0(); - test1(); - test2(); - test3(); - test4(); - test5(); - test6(); - test7(); - test8(); - } -#if TEST_STD_VER >= 11 - { - typedef std::basic_string, min_allocator> S; - test0(); - test1(); - test2(); - test3(); - test4(); - test5(); - test6(); - test7(); - test8(); - } -#endif +template +bool test9() { #ifndef TEST_HAS_NO_EXCEPTIONS - { // test iterator operations that throw - typedef std::string S; + { // test iterator operations that throw typedef ThrowingIterator TIter; typedef cpp17_input_iterator IIter; const char* s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; @@ -1018,11 +1009,10 @@ Widget w[100]; test_exceptions(S("abcdefghijklmnopqrst"), 10, 5, w, w+100); - } + } #endif - { // test replacing into self - typedef std::string S; + { // test replacing into self S s_short = "123/"; S s_long = "Lorem ipsum dolor sit amet, consectetur/"; @@ -1035,10 +1025,9 @@ s_long.replace(s_long.begin(), s_long.begin(), s_long.begin(), s_long.end()); assert(s_long == "Lorem ipsum dolor sit amet, consectetur/Lorem ipsum dolor sit amet, consectetur/"); - } + } - { // test assigning a different type - typedef std::string S; + { // test assigning a different type const uint8_t pc[] = "ABCD"; uint8_t p[] = "EFGH"; @@ -1049,7 +1038,44 @@ s.clear(); s.replace(s.begin(), s.end(), p, p + 4); assert(s == "EFGH"); - } + } + + return true; +} + +template +void test() { + test0(); + test1(); + test2(); + test3(); + test4(); + test5(); + test6(); + test7(); + test8(); + test9(); + +#if TEST_STD_VER > 17 + // static_assert(test0()); + // static_assert(test1()); + // static_assert(test2()); + // static_assert(test3()); + // static_assert(test4()); + // static_assert(test5()); + // static_assert(test6()); + // static_assert(test7()); + // static_assert(test8()); + // static_assert(test9()); +#endif +} + +int main(int, char**) +{ + test(); +#if TEST_STD_VER >= 11 + test, min_allocator>>(); +#endif return 0; } diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer.pass.cpp @@ -21,7 +21,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(S s, typename S::size_type pos1, typename S::size_type n1, const typename S::value_type* str, S expected) { typename S::size_type old_size = s.size(); @@ -36,7 +36,7 @@ } template -void test0() +TEST_CONSTEXPR_CXX20 void test0() { test(S(""), 0, 0, "", S("")); test(S(""), 0, 0, "12345", S("12345")); @@ -141,7 +141,7 @@ } template -void test1() +TEST_CONSTEXPR_CXX20 void test1() { test(S("abcdefghij"), 1, 4, "", S("afghij")); test(S("abcdefghij"), 1, 4, "12345", S("a12345fghij")); @@ -246,7 +246,7 @@ } template -void test2() +TEST_CONSTEXPR_CXX20 void test2() { test(S("abcdefghijklmnopqrst"), 10, 10, "", S("abcdefghij")); test(S("abcdefghijklmnopqrst"), 10, 10, "12345", S("abcdefghij12345")); @@ -266,24 +266,23 @@ test(S("abcdefghijklmnopqrst"), 20, 0, "12345678901234567890", S("abcdefghijklmnopqrst12345678901234567890")); } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; test0(); test1(); test2(); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; test0(); test1(); test2(); - } + } #endif - { // test replacing into self + { // test replacing into self typedef std::string S; S s_short = "123/"; S s_long = "Lorem ipsum dolor sit amet, consectetur/"; @@ -297,7 +296,17 @@ s_long.replace(s_long.begin(), s_long.begin(), 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; } diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer_size.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer_size.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer_size.pass.cpp @@ -19,7 +19,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(S s, typename S::size_type pos1, typename S::size_type n1, const typename S::value_type* str, typename S::size_type n2, S expected) { @@ -35,7 +35,7 @@ } template -void test0() +TEST_CONSTEXPR_CXX20 bool test0() { test(S(""), 0, 0, "", 0, S("")); test(S(""), 0, 0, "12345", 0, S("")); @@ -137,10 +137,12 @@ test(S("abcde"), 1, 0, "12345", 0, S("abcde")); test(S("abcde"), 1, 0, "12345", 1, S("a1bcde")); test(S("abcde"), 1, 0, "12345", 2, S("a12bcde")); + + return true; } template -void test1() +TEST_CONSTEXPR_CXX20 bool test1() { test(S("abcde"), 1, 0, "12345", 4, S("a1234bcde")); test(S("abcde"), 1, 0, "12345", 5, S("a12345bcde")); @@ -242,10 +244,12 @@ test(S("abcde"), 2, 1, "12345", 5, S("ab12345de")); test(S("abcde"), 2, 1, "1234567890", 0, S("abde")); test(S("abcde"), 2, 1, "1234567890", 1, S("ab1de")); + + return true; } template -void test2() +TEST_CONSTEXPR_CXX20 bool test2() { test(S("abcde"), 2, 1, "1234567890", 5, S("ab12345de")); test(S("abcde"), 2, 1, "1234567890", 9, S("ab123456789de")); @@ -347,10 +351,12 @@ test(S("abcdefghij"), 0, 0, "1234567890", 9, S("123456789abcdefghij")); test(S("abcdefghij"), 0, 0, "1234567890", 10, S("1234567890abcdefghij")); test(S("abcdefghij"), 0, 0, "12345678901234567890", 0, S("abcdefghij")); + + return true; } template -void test3() +TEST_CONSTEXPR_CXX20 bool test3() { test(S("abcdefghij"), 0, 0, "12345678901234567890", 1, S("1abcdefghij")); test(S("abcdefghij"), 0, 0, "12345678901234567890", 10, S("1234567890abcdefghij")); @@ -452,10 +458,12 @@ test(S("abcdefghij"), 1, 1, "12345678901234567890", 10, S("a1234567890cdefghij")); test(S("abcdefghij"), 1, 1, "12345678901234567890", 19, S("a1234567890123456789cdefghij")); test(S("abcdefghij"), 1, 1, "12345678901234567890", 20, S("a12345678901234567890cdefghij")); + + return true; } template -void test4() +TEST_CONSTEXPR_CXX20 bool test4() { test(S("abcdefghij"), 1, 4, "", 0, S("afghij")); test(S("abcdefghij"), 1, 4, "12345", 0, S("afghij")); @@ -557,10 +565,12 @@ test(S("abcdefghij"), 5, 4, "12345", 0, S("abcdej")); test(S("abcdefghij"), 5, 4, "12345", 1, S("abcde1j")); test(S("abcdefghij"), 5, 4, "12345", 2, S("abcde12j")); + + return true; } template -void test5() +TEST_CONSTEXPR_CXX20 bool test5() { test(S("abcdefghij"), 5, 4, "12345", 4, S("abcde1234j")); test(S("abcdefghij"), 5, 4, "12345", 5, S("abcde12345j")); @@ -662,10 +672,12 @@ test(S("abcdefghijklmnopqrst"), 0, 1, "12345", 5, S("12345bcdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 0, 1, "1234567890", 0, S("bcdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 0, 1, "1234567890", 1, S("1bcdefghijklmnopqrst")); + + return true; } template -void test6() +TEST_CONSTEXPR_CXX20 bool test6() { test(S("abcdefghijklmnopqrst"), 0, 1, "1234567890", 5, S("12345bcdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 0, 1, "1234567890", 9, S("123456789bcdefghijklmnopqrst")); @@ -767,10 +779,12 @@ test(S("abcdefghijklmnopqrst"), 1, 9, "1234567890", 9, S("a123456789klmnopqrst")); test(S("abcdefghijklmnopqrst"), 1, 9, "1234567890", 10, S("a1234567890klmnopqrst")); test(S("abcdefghijklmnopqrst"), 1, 9, "12345678901234567890", 0, S("aklmnopqrst")); + + return true; } template -void test7() +TEST_CONSTEXPR_CXX20 bool test7() { test(S("abcdefghijklmnopqrst"), 1, 9, "12345678901234567890", 1, S("a1klmnopqrst")); test(S("abcdefghijklmnopqrst"), 1, 9, "12345678901234567890", 10, S("a1234567890klmnopqrst")); @@ -872,10 +886,12 @@ test(S("abcdefghijklmnopqrst"), 10, 9, "12345678901234567890", 10, S("abcdefghij1234567890t")); test(S("abcdefghijklmnopqrst"), 10, 9, "12345678901234567890", 19, S("abcdefghij1234567890123456789t")); test(S("abcdefghijklmnopqrst"), 10, 9, "12345678901234567890", 20, S("abcdefghij12345678901234567890t")); + + return true; } template -void test8() +TEST_CONSTEXPR_CXX20 bool test8() { test(S("abcdefghijklmnopqrst"), 10, 10, "", 0, S("abcdefghij")); test(S("abcdefghijklmnopqrst"), 10, 10, "12345", 0, S("abcdefghij")); @@ -941,52 +957,61 @@ test(S("abcdefghijklmnopqrst"), 20, 0, "12345678901234567890", 10, S("abcdefghijklmnopqrst1234567890")); test(S("abcdefghijklmnopqrst"), 20, 0, "12345678901234567890", 19, S("abcdefghijklmnopqrst1234567890123456789")); test(S("abcdefghijklmnopqrst"), 20, 0, "12345678901234567890", 20, S("abcdefghijklmnopqrst12345678901234567890")); + + return true; +} + +template +bool test9() { + S s_short = "123/"; + S s_long = "Lorem ipsum dolor sit amet, consectetur/"; + + s_short.replace(s_short.begin(), s_short.begin(), s_short.data(), s_short.size()); + assert(s_short == "123/123/"); + s_short.replace(s_short.begin(), s_short.begin(), s_short.data(), s_short.size()); + assert(s_short == "123/123/123/123/"); + s_short.replace(s_short.begin(), s_short.begin(), s_short.data(), s_short.size()); + assert(s_short == "123/123/123/123/123/123/123/123/"); + + s_long.replace(s_long.begin(), s_long.begin(), s_long.data(), s_long.size()); + assert(s_long == "Lorem ipsum dolor sit amet, consectetur/Lorem ipsum dolor sit amet, consectetur/"); + + return true; +} + +template +void test() { + test0(); + test1(); + test2(); + test3(); + test4(); + test5(); + test6(); + test7(); + test8(); + test9(); + +#if TEST_STD_VER > 17 + // static_assert(test0()); + // static_assert(test1()); + // static_assert(test2()); + // static_assert(test3()); + // static_assert(test4()); + // static_assert(test5()); + // static_assert(test6()); + // static_assert(test7()); + // static_assert(test8()); + // static_assert(test9()); +#endif } int main(int, char**) { - { - typedef std::string S; - test0(); - test1(); - test2(); - test3(); - test4(); - test5(); - test6(); - test7(); - test8(); - } + test(); #if TEST_STD_VER >= 11 - { - typedef std::basic_string, min_allocator> S; - test0(); - test1(); - test2(); - test3(); - test4(); - test5(); - test6(); - test7(); - test8(); - } + test, min_allocator>>(); #endif - { // test replacing into self - typedef std::string S; - S s_short = "123/"; - S s_long = "Lorem ipsum dolor sit amet, consectetur/"; - - s_short.replace(s_short.begin(), s_short.begin(), s_short.data(), s_short.size()); - assert(s_short == "123/123/"); - s_short.replace(s_short.begin(), s_short.begin(), s_short.data(), s_short.size()); - assert(s_short == "123/123/123/123/"); - s_short.replace(s_short.begin(), s_short.begin(), s_short.data(), s_short.size()); - assert(s_short == "123/123/123/123/123/123/123/123/"); - - s_long.replace(s_long.begin(), s_long.begin(), s_long.data(), s_long.size()); - assert(s_long == "Lorem ipsum dolor sit amet, consectetur/Lorem ipsum dolor sit amet, consectetur/"); - } - return 0; } diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_size_char.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_size_char.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_size_char.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_size_char.pass.cpp @@ -19,7 +19,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(S s, typename S::size_type pos1, typename S::size_type n1, typename S::size_type n2, typename S::value_type c, S expected) { @@ -265,21 +265,30 @@ test(S("abcdefghijklmnopqrst"), 20, 0, 20, '3', S("abcdefghijklmnopqrst33333333333333333333")); } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; test0(); test1(); test2(); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; test0(); test1(); test2(); - } + } +#endif + + return true; +} + +int main(int, char**) +{ + test(); +#if TEST_STD_VER > 17 + // static_assert(test()); #endif return 0; diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_string.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_string.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_string.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_string.pass.cpp @@ -19,7 +19,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(S s, typename S::size_type pos1, typename S::size_type n1, S str, S expected) { typename S::size_type old_size = s.size(); @@ -34,7 +34,7 @@ } template -void test0() +TEST_CONSTEXPR_CXX20 void test0() { test(S(""), 0, 0, S(""), S("")); test(S(""), 0, 0, S("12345"), S("12345")); @@ -139,7 +139,7 @@ } template -void test1() +TEST_CONSTEXPR_CXX20 void test1() { test(S("abcdefghij"), 1, 4, S(""), S("afghij")); test(S("abcdefghij"), 1, 4, S("12345"), S("a12345fghij")); @@ -244,7 +244,7 @@ } template -void test2() +TEST_CONSTEXPR_CXX20 void test2() { test(S("abcdefghijklmnopqrst"), 10, 10, S(""), S("abcdefghij")); test(S("abcdefghijklmnopqrst"), 10, 10, S("12345"), S("abcdefghij12345")); @@ -264,30 +264,39 @@ test(S("abcdefghijklmnopqrst"), 20, 0, S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890")); } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; test0(); test1(); test2(); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; test0(); test1(); test2(); - } + } #endif #if TEST_STD_VER > 3 - { // LWG 2946 + { // LWG 2946 std::string s = " "; s.replace(s.cbegin(), s.cend(), {"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; diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_string_view.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_string_view.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_string_view.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_string_view.pass.cpp @@ -19,7 +19,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(S s, typename S::size_type pos1, typename S::size_type n1, SV sv, S expected) { typename S::size_type old_size = s.size(); @@ -34,7 +34,7 @@ } template -void test0() +TEST_CONSTEXPR_CXX20 void test0() { test(S(""), 0, 0, SV(""), S("")); test(S(""), 0, 0, SV("12345"), S("12345")); @@ -139,7 +139,7 @@ } template -void test1() +TEST_CONSTEXPR_CXX20 void test1() { test(S("abcdefghij"), 1, 4, SV(""), S("afghij")); test(S("abcdefghij"), 1, 4, SV("12345"), S("a12345fghij")); @@ -244,7 +244,7 @@ } template -void test2() +TEST_CONSTEXPR_CXX20 void test2() { test(S("abcdefghijklmnopqrst"), 10, 10, SV(""), S("abcdefghij")); test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345"), S("abcdefghij12345")); @@ -264,23 +264,32 @@ test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890")); } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; typedef std::string_view SV; test0(); test1(); test2(); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; typedef std::string_view SV; test0(); test1(); test2(); - } + } +#endif + + return true; +} + +int main(int, char**) +{ + test(); +#if TEST_STD_VER > 17 + // static_assert(test()); #endif return 0; diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_T_size_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_T_size_size.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_T_size_size.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_T_size_size.pass.cpp @@ -23,7 +23,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(S s, typename S::size_type pos1, typename S::size_type n1, SV sv, typename S::size_type pos2, typename S::size_type n2, S expected) @@ -64,7 +64,7 @@ } template -void +TEST_CONSTEXPR_CXX20 void test_npos(S s, typename S::size_type pos1, typename S::size_type n1, SV sv, typename S::size_type pos2, S expected) @@ -101,7 +101,7 @@ template -void test0() +TEST_CONSTEXPR_CXX20 bool test0() { test(S(""), 0, 0, SV(""), 0, 0, S("")); test(S(""), 0, 0, SV(""), 0, 1, S("")); @@ -203,10 +203,12 @@ test(S(""), 0, 1, SV("12345"), 5, 0, S("")); test(S(""), 0, 1, SV("12345"), 5, 1, S("")); test(S(""), 0, 1, SV("12345"), 6, 0, S("can't happen")); + + return true; } template -void test1() +TEST_CONSTEXPR_CXX20 bool test1() { test(S(""), 0, 1, SV("1234567890"), 0, 0, S("")); test(S(""), 0, 1, SV("1234567890"), 0, 1, S("1")); @@ -308,10 +310,12 @@ test(S(""), 1, 0, SV("1234567890"), 11, 0, S("can't happen")); test(S(""), 1, 0, SV("12345678901234567890"), 0, 0, S("can't happen")); test(S(""), 1, 0, SV("12345678901234567890"), 0, 1, S("can't happen")); + + return true; } template -void test2() +TEST_CONSTEXPR_CXX20 bool test2() { test(S(""), 1, 0, SV("12345678901234567890"), 0, 10, S("can't happen")); test(S(""), 1, 0, SV("12345678901234567890"), 0, 19, S("can't happen")); @@ -413,10 +417,12 @@ test(S("abcde"), 0, 1, SV(""), 0, 1, S("bcde")); test(S("abcde"), 0, 1, SV(""), 1, 0, S("can't happen")); test(S("abcde"), 0, 1, SV("12345"), 0, 0, S("bcde")); + + return true; } template -void test3() +TEST_CONSTEXPR_CXX20 bool test3() { test(S("abcde"), 0, 1, SV("12345"), 0, 1, S("1bcde")); test(S("abcde"), 0, 1, SV("12345"), 0, 2, S("12bcde")); @@ -518,10 +524,12 @@ test(S("abcde"), 0, 2, SV("1234567890"), 0, 1, S("1cde")); test(S("abcde"), 0, 2, SV("1234567890"), 0, 5, S("12345cde")); test(S("abcde"), 0, 2, SV("1234567890"), 0, 9, S("123456789cde")); + + return true; } template -void test4() +TEST_CONSTEXPR_CXX20 bool test4() { test(S("abcde"), 0, 2, SV("1234567890"), 0, 10, S("1234567890cde")); test(S("abcde"), 0, 2, SV("1234567890"), 0, 11, S("1234567890cde")); @@ -623,10 +631,12 @@ test(S("abcde"), 0, 4, SV("12345678901234567890"), 0, 19, S("1234567890123456789e")); test(S("abcde"), 0, 4, SV("12345678901234567890"), 0, 20, S("12345678901234567890e")); test(S("abcde"), 0, 4, SV("12345678901234567890"), 0, 21, S("12345678901234567890e")); + + return true; } template -void test5() +TEST_CONSTEXPR_CXX20 bool test5() { test(S("abcde"), 0, 4, SV("12345678901234567890"), 1, 0, S("e")); test(S("abcde"), 0, 4, SV("12345678901234567890"), 1, 1, S("2e")); @@ -728,10 +738,12 @@ test(S("abcde"), 0, 6, SV("12345"), 0, 2, S("12")); test(S("abcde"), 0, 6, SV("12345"), 0, 4, S("1234")); test(S("abcde"), 0, 6, SV("12345"), 0, 5, S("12345")); + + return true; } template -void test6() +TEST_CONSTEXPR_CXX20 bool test6() { test(S("abcde"), 0, 6, SV("12345"), 0, 6, S("12345")); test(S("abcde"), 0, 6, SV("12345"), 1, 0, S("")); @@ -833,10 +845,12 @@ test(S("abcde"), 1, 0, SV("1234567890"), 0, 11, S("a1234567890bcde")); test(S("abcde"), 1, 0, SV("1234567890"), 1, 0, S("abcde")); test(S("abcde"), 1, 0, SV("1234567890"), 1, 1, S("a2bcde")); + + return true; } template -void test7() +TEST_CONSTEXPR_CXX20 bool test7() { test(S("abcde"), 1, 0, SV("1234567890"), 1, 4, S("a2345bcde")); test(S("abcde"), 1, 0, SV("1234567890"), 1, 8, S("a23456789bcde")); @@ -938,10 +952,12 @@ test(S("abcde"), 1, 1, SV("12345678901234567890"), 1, 1, S("a2cde")); test(S("abcde"), 1, 1, SV("12345678901234567890"), 1, 9, S("a234567890cde")); test(S("abcde"), 1, 1, SV("12345678901234567890"), 1, 18, S("a234567890123456789cde")); + + return true; } template -void test8() +TEST_CONSTEXPR_CXX20 bool test8() { test(S("abcde"), 1, 1, SV("12345678901234567890"), 1, 19, S("a2345678901234567890cde")); test(S("abcde"), 1, 1, SV("12345678901234567890"), 1, 20, S("a2345678901234567890cde")); @@ -1043,10 +1059,12 @@ test(S("abcde"), 1, 3, SV("12345"), 1, 0, S("ae")); test(S("abcde"), 1, 3, SV("12345"), 1, 1, S("a2e")); test(S("abcde"), 1, 3, SV("12345"), 1, 2, S("a23e")); + + return true; } template -void test9() +TEST_CONSTEXPR_CXX20 bool test9() { test(S("abcde"), 1, 3, SV("12345"), 1, 3, S("a234e")); test(S("abcde"), 1, 3, SV("12345"), 1, 4, S("a2345e")); @@ -1148,10 +1166,12 @@ test(S("abcde"), 1, 4, SV("1234567890"), 1, 8, S("a23456789")); test(S("abcde"), 1, 4, SV("1234567890"), 1, 9, S("a234567890")); test(S("abcde"), 1, 4, SV("1234567890"), 1, 10, S("a234567890")); + + return true; } template -void test10() +TEST_CONSTEXPR_CXX20 bool test10() { test(S("abcde"), 1, 4, SV("1234567890"), 5, 0, S("a")); test(S("abcde"), 1, 4, SV("1234567890"), 5, 1, S("a6")); @@ -1253,10 +1273,12 @@ test(S("abcde"), 1, 5, SV("12345678901234567890"), 1, 20, S("a2345678901234567890")); test(S("abcde"), 1, 5, SV("12345678901234567890"), 10, 0, S("a")); test(S("abcde"), 1, 5, SV("12345678901234567890"), 10, 1, S("a1")); + + return true; } template -void test11() +TEST_CONSTEXPR_CXX20 bool test11() { test(S("abcde"), 1, 5, SV("12345678901234567890"), 10, 5, S("a12345")); test(S("abcde"), 1, 5, SV("12345678901234567890"), 10, 9, S("a123456789")); @@ -1358,10 +1380,12 @@ test(S("abcde"), 2, 1, SV("12345"), 1, 4, S("ab2345de")); test(S("abcde"), 2, 1, SV("12345"), 1, 5, S("ab2345de")); test(S("abcde"), 2, 1, SV("12345"), 2, 0, S("abde")); + + return true; } template -void test12() +TEST_CONSTEXPR_CXX20 bool test12() { test(S("abcde"), 2, 1, SV("12345"), 2, 1, S("ab3de")); test(S("abcde"), 2, 1, SV("12345"), 2, 2, S("ab34de")); @@ -1463,10 +1487,12 @@ test(S("abcde"), 2, 2, SV("1234567890"), 5, 1, S("ab6e")); test(S("abcde"), 2, 2, SV("1234567890"), 5, 2, S("ab67e")); test(S("abcde"), 2, 2, SV("1234567890"), 5, 4, S("ab6789e")); + + return true; } template -void test13() +TEST_CONSTEXPR_CXX20 bool test13() { test(S("abcde"), 2, 2, SV("1234567890"), 5, 5, S("ab67890e")); test(S("abcde"), 2, 2, SV("1234567890"), 5, 6, S("ab67890e")); @@ -1568,10 +1594,12 @@ test(S("abcde"), 2, 3, SV("12345678901234567890"), 10, 9, S("ab123456789")); test(S("abcde"), 2, 3, SV("12345678901234567890"), 10, 10, S("ab1234567890")); test(S("abcde"), 2, 3, SV("12345678901234567890"), 10, 11, S("ab1234567890")); + + return true; } template -void test14() +TEST_CONSTEXPR_CXX20 bool test14() { test(S("abcde"), 2, 3, SV("12345678901234567890"), 19, 0, S("ab")); test(S("abcde"), 2, 3, SV("12345678901234567890"), 19, 1, S("ab0")); @@ -1673,10 +1701,12 @@ test(S("abcde"), 4, 0, SV("12345"), 2, 2, S("abcd34e")); test(S("abcde"), 4, 0, SV("12345"), 2, 3, S("abcd345e")); test(S("abcde"), 4, 0, SV("12345"), 2, 4, S("abcd345e")); + + return true; } template -void test15() +TEST_CONSTEXPR_CXX20 bool test15() { test(S("abcde"), 4, 0, SV("12345"), 4, 0, S("abcde")); test(S("abcde"), 4, 0, SV("12345"), 4, 1, S("abcd5e")); @@ -1778,10 +1808,12 @@ test(S("abcde"), 4, 1, SV("1234567890"), 5, 6, S("abcd67890")); test(S("abcde"), 4, 1, SV("1234567890"), 9, 0, S("abcd")); test(S("abcde"), 4, 1, SV("1234567890"), 9, 1, S("abcd0")); + + return true; } template -void test16() +TEST_CONSTEXPR_CXX20 bool test16() { test(S("abcde"), 4, 1, SV("1234567890"), 9, 2, S("abcd0")); test(S("abcde"), 4, 1, SV("1234567890"), 10, 0, S("abcd")); @@ -1883,10 +1915,12 @@ test(S("abcde"), 4, 2, SV("12345678901234567890"), 19, 1, S("abcd0")); test(S("abcde"), 4, 2, SV("12345678901234567890"), 19, 2, S("abcd0")); test(S("abcde"), 4, 2, SV("12345678901234567890"), 20, 0, S("abcd")); + + return true; } template -void test17() +TEST_CONSTEXPR_CXX20 bool test17() { test(S("abcde"), 4, 2, SV("12345678901234567890"), 20, 1, S("abcd")); test(S("abcde"), 4, 2, SV("12345678901234567890"), 21, 0, S("can't happen")); @@ -1988,10 +2022,12 @@ test(S("abcde"), 5, 1, SV("12345"), 4, 1, S("abcde5")); test(S("abcde"), 5, 1, SV("12345"), 4, 2, S("abcde5")); test(S("abcde"), 5, 1, SV("12345"), 5, 0, S("abcde")); + + return true; } template -void test18() +TEST_CONSTEXPR_CXX20 bool test18() { test(S("abcde"), 5, 1, SV("12345"), 5, 1, S("abcde")); test(S("abcde"), 5, 1, SV("12345"), 6, 0, S("can't happen")); @@ -2093,10 +2129,12 @@ test(S("abcde"), 6, 0, SV("1234567890"), 10, 0, S("can't happen")); test(S("abcde"), 6, 0, SV("1234567890"), 10, 1, S("can't happen")); test(S("abcde"), 6, 0, SV("1234567890"), 11, 0, S("can't happen")); + + return true; } template -void test19() +TEST_CONSTEXPR_CXX20 bool test19() { test(S("abcde"), 6, 0, SV("12345678901234567890"), 0, 0, S("can't happen")); test(S("abcde"), 6, 0, SV("12345678901234567890"), 0, 1, S("can't happen")); @@ -2198,10 +2236,12 @@ test(S("abcdefghij"), 0, 0, SV("12345678901234567890"), 21, 0, S("can't happen")); test(S("abcdefghij"), 0, 1, SV(""), 0, 0, S("bcdefghij")); test(S("abcdefghij"), 0, 1, SV(""), 0, 1, S("bcdefghij")); + + return true; } template -void test20() +TEST_CONSTEXPR_CXX20 bool test20() { test(S("abcdefghij"), 0, 1, SV(""), 1, 0, S("can't happen")); test(S("abcdefghij"), 0, 1, SV("12345"), 0, 0, S("bcdefghij")); @@ -2303,10 +2343,12 @@ test(S("abcdefghij"), 0, 5, SV("12345"), 6, 0, S("can't happen")); test(S("abcdefghij"), 0, 5, SV("1234567890"), 0, 0, S("fghij")); test(S("abcdefghij"), 0, 5, SV("1234567890"), 0, 1, S("1fghij")); + + return true; } template -void test21() +TEST_CONSTEXPR_CXX20 bool test21() { test(S("abcdefghij"), 0, 5, SV("1234567890"), 0, 5, S("12345fghij")); test(S("abcdefghij"), 0, 5, SV("1234567890"), 0, 9, S("123456789fghij")); @@ -2408,10 +2450,12 @@ test(S("abcdefghij"), 0, 9, SV("12345678901234567890"), 0, 1, S("1j")); test(S("abcdefghij"), 0, 9, SV("12345678901234567890"), 0, 10, S("1234567890j")); test(S("abcdefghij"), 0, 9, SV("12345678901234567890"), 0, 19, S("1234567890123456789j")); + + return true; } template -void test22() +TEST_CONSTEXPR_CXX20 bool test22() { test(S("abcdefghij"), 0, 9, SV("12345678901234567890"), 0, 20, S("12345678901234567890j")); test(S("abcdefghij"), 0, 9, SV("12345678901234567890"), 0, 21, S("12345678901234567890j")); @@ -2513,10 +2557,12 @@ test(S("abcdefghij"), 0, 11, SV("12345"), 0, 0, S("")); test(S("abcdefghij"), 0, 11, SV("12345"), 0, 1, S("1")); test(S("abcdefghij"), 0, 11, SV("12345"), 0, 2, S("12")); + + return true; } template -void test23() +TEST_CONSTEXPR_CXX20 bool test23() { test(S("abcdefghij"), 0, 11, SV("12345"), 0, 4, S("1234")); test(S("abcdefghij"), 0, 11, SV("12345"), 0, 5, S("12345")); @@ -2618,10 +2664,12 @@ test(S("abcdefghij"), 1, 0, SV("1234567890"), 0, 9, S("a123456789bcdefghij")); test(S("abcdefghij"), 1, 0, SV("1234567890"), 0, 10, S("a1234567890bcdefghij")); test(S("abcdefghij"), 1, 0, SV("1234567890"), 0, 11, S("a1234567890bcdefghij")); + + return true; } template -void test24() +TEST_CONSTEXPR_CXX20 bool test24() { test(S("abcdefghij"), 1, 0, SV("1234567890"), 1, 0, S("abcdefghij")); test(S("abcdefghij"), 1, 0, SV("1234567890"), 1, 1, S("a2bcdefghij")); @@ -2723,10 +2771,12 @@ test(S("abcdefghij"), 1, 1, SV("12345678901234567890"), 0, 21, S("a12345678901234567890cdefghij")); test(S("abcdefghij"), 1, 1, SV("12345678901234567890"), 1, 0, S("acdefghij")); test(S("abcdefghij"), 1, 1, SV("12345678901234567890"), 1, 1, S("a2cdefghij")); + + return true; } template -void test25() +TEST_CONSTEXPR_CXX20 bool test25() { test(S("abcdefghij"), 1, 1, SV("12345678901234567890"), 1, 9, S("a234567890cdefghij")); test(S("abcdefghij"), 1, 1, SV("12345678901234567890"), 1, 18, S("a234567890123456789cdefghij")); @@ -2828,10 +2878,12 @@ test(S("abcdefghij"), 1, 8, SV("12345"), 0, 5, S("a12345j")); test(S("abcdefghij"), 1, 8, SV("12345"), 0, 6, S("a12345j")); test(S("abcdefghij"), 1, 8, SV("12345"), 1, 0, S("aj")); + + return true; } template -void test26() +TEST_CONSTEXPR_CXX20 bool test26() { test(S("abcdefghij"), 1, 8, SV("12345"), 1, 1, S("a2j")); test(S("abcdefghij"), 1, 8, SV("12345"), 1, 2, S("a23j")); @@ -2933,10 +2985,12 @@ test(S("abcdefghij"), 1, 9, SV("1234567890"), 1, 1, S("a2")); test(S("abcdefghij"), 1, 9, SV("1234567890"), 1, 4, S("a2345")); test(S("abcdefghij"), 1, 9, SV("1234567890"), 1, 8, S("a23456789")); + + return true; } template -void test27() +TEST_CONSTEXPR_CXX20 bool test27() { test(S("abcdefghij"), 1, 9, SV("1234567890"), 1, 9, S("a234567890")); test(S("abcdefghij"), 1, 9, SV("1234567890"), 1, 10, S("a234567890")); @@ -3038,10 +3092,12 @@ test(S("abcdefghij"), 1, 10, SV("12345678901234567890"), 1, 18, S("a234567890123456789")); test(S("abcdefghij"), 1, 10, SV("12345678901234567890"), 1, 19, S("a2345678901234567890")); test(S("abcdefghij"), 1, 10, SV("12345678901234567890"), 1, 20, S("a2345678901234567890")); + + return true; } template -void test28() +TEST_CONSTEXPR_CXX20 bool test28() { test(S("abcdefghij"), 1, 10, SV("12345678901234567890"), 10, 0, S("a")); test(S("abcdefghij"), 1, 10, SV("12345678901234567890"), 10, 1, S("a1")); @@ -3143,10 +3199,12 @@ test(S("abcdefghij"), 5, 1, SV("12345"), 1, 2, S("abcde23ghij")); test(S("abcdefghij"), 5, 1, SV("12345"), 1, 3, S("abcde234ghij")); test(S("abcdefghij"), 5, 1, SV("12345"), 1, 4, S("abcde2345ghij")); + + return true; } template -void test29() +TEST_CONSTEXPR_CXX20 bool test29() { test(S("abcdefghij"), 5, 1, SV("12345"), 1, 5, S("abcde2345ghij")); test(S("abcdefghij"), 5, 1, SV("12345"), 2, 0, S("abcdeghij")); @@ -3248,10 +3306,12 @@ test(S("abcdefghij"), 5, 2, SV("1234567890"), 1, 10, S("abcde234567890hij")); test(S("abcdefghij"), 5, 2, SV("1234567890"), 5, 0, S("abcdehij")); test(S("abcdefghij"), 5, 2, SV("1234567890"), 5, 1, S("abcde6hij")); + + return true; } template -void test30() +TEST_CONSTEXPR_CXX20 bool test30() { test(S("abcdefghij"), 5, 2, SV("1234567890"), 5, 2, S("abcde67hij")); test(S("abcdefghij"), 5, 2, SV("1234567890"), 5, 4, S("abcde6789hij")); @@ -3353,10 +3413,12 @@ test(S("abcdefghij"), 5, 4, SV("12345678901234567890"), 10, 1, S("abcde1j")); test(S("abcdefghij"), 5, 4, SV("12345678901234567890"), 10, 5, S("abcde12345j")); test(S("abcdefghij"), 5, 4, SV("12345678901234567890"), 10, 9, S("abcde123456789j")); + + return true; } template -void test31() +TEST_CONSTEXPR_CXX20 bool test31() { test(S("abcdefghij"), 5, 4, SV("12345678901234567890"), 10, 10, S("abcde1234567890j")); test(S("abcdefghij"), 5, 4, SV("12345678901234567890"), 10, 11, S("abcde1234567890j")); @@ -3458,10 +3520,12 @@ test(S("abcdefghij"), 5, 6, SV("12345"), 2, 0, S("abcde")); test(S("abcdefghij"), 5, 6, SV("12345"), 2, 1, S("abcde3")); test(S("abcdefghij"), 5, 6, SV("12345"), 2, 2, S("abcde34")); + + return true; } template -void test32() +TEST_CONSTEXPR_CXX20 bool test32() { test(S("abcdefghij"), 5, 6, SV("12345"), 2, 3, S("abcde345")); test(S("abcdefghij"), 5, 6, SV("12345"), 2, 4, S("abcde345")); @@ -3563,10 +3627,12 @@ test(S("abcdefghij"), 9, 0, SV("1234567890"), 5, 4, S("abcdefghi6789j")); test(S("abcdefghij"), 9, 0, SV("1234567890"), 5, 5, S("abcdefghi67890j")); test(S("abcdefghij"), 9, 0, SV("1234567890"), 5, 6, S("abcdefghi67890j")); + + return true; } template -void test33() +TEST_CONSTEXPR_CXX20 bool test33() { test(S("abcdefghij"), 9, 0, SV("1234567890"), 9, 0, S("abcdefghij")); test(S("abcdefghij"), 9, 0, SV("1234567890"), 9, 1, S("abcdefghi0j")); @@ -3668,10 +3734,12 @@ test(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 10, 11, S("abcdefghi1234567890")); test(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 19, 0, S("abcdefghi")); test(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 19, 1, S("abcdefghi0")); + + return true; } template -void test34() +TEST_CONSTEXPR_CXX20 bool test34() { test(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 19, 2, S("abcdefghi0")); test(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 20, 0, S("abcdefghi")); @@ -3773,10 +3841,12 @@ test(S("abcdefghij"), 10, 0, SV("12345"), 2, 4, S("abcdefghij345")); test(S("abcdefghij"), 10, 0, SV("12345"), 4, 0, S("abcdefghij")); test(S("abcdefghij"), 10, 0, SV("12345"), 4, 1, S("abcdefghij5")); + + return true; } template -void test35() +TEST_CONSTEXPR_CXX20 bool test35() { test(S("abcdefghij"), 10, 0, SV("12345"), 4, 2, S("abcdefghij5")); test(S("abcdefghij"), 10, 0, SV("12345"), 5, 0, S("abcdefghij")); @@ -3878,10 +3948,12 @@ test(S("abcdefghij"), 10, 1, SV("1234567890"), 9, 1, S("abcdefghij0")); test(S("abcdefghij"), 10, 1, SV("1234567890"), 9, 2, S("abcdefghij0")); test(S("abcdefghij"), 10, 1, SV("1234567890"), 10, 0, S("abcdefghij")); + + return true; } template -void test36() +TEST_CONSTEXPR_CXX20 bool test36() { test(S("abcdefghij"), 10, 1, SV("1234567890"), 10, 1, S("abcdefghij")); test(S("abcdefghij"), 10, 1, SV("1234567890"), 11, 0, S("can't happen")); @@ -3983,10 +4055,12 @@ test(S("abcdefghij"), 11, 0, SV("12345678901234567890"), 20, 0, S("can't happen")); test(S("abcdefghij"), 11, 0, SV("12345678901234567890"), 20, 1, S("can't happen")); test(S("abcdefghij"), 11, 0, SV("12345678901234567890"), 21, 0, S("can't happen")); + + return true; } template -void test37() +TEST_CONSTEXPR_CXX20 bool test37() { test(S("abcdefghijklmnopqrst"), 0, 0, SV(""), 0, 0, S("abcdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 0, 0, SV(""), 0, 1, S("abcdefghijklmnopqrst")); @@ -4088,10 +4162,12 @@ test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345"), 5, 0, S("bcdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345"), 5, 1, S("bcdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345"), 6, 0, S("can't happen")); + + return true; } template -void test38() +TEST_CONSTEXPR_CXX20 bool test38() { test(S("abcdefghijklmnopqrst"), 0, 1, SV("1234567890"), 0, 0, S("bcdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 0, 1, SV("1234567890"), 0, 1, S("1bcdefghijklmnopqrst")); @@ -4193,10 +4269,12 @@ test(S("abcdefghijklmnopqrst"), 0, 10, SV("1234567890"), 11, 0, S("can't happen")); test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345678901234567890"), 0, 0, S("klmnopqrst")); test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345678901234567890"), 0, 1, S("1klmnopqrst")); + + return true; } template -void test39() +TEST_CONSTEXPR_CXX20 bool test39() { test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345678901234567890"), 0, 10, S("1234567890klmnopqrst")); test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345678901234567890"), 0, 19, S("1234567890123456789klmnopqrst")); @@ -4298,10 +4376,12 @@ test(S("abcdefghijklmnopqrst"), 0, 20, SV(""), 0, 1, S("")); test(S("abcdefghijklmnopqrst"), 0, 20, SV(""), 1, 0, S("can't happen")); test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345"), 0, 0, S("")); + + return true; } template -void test40() +TEST_CONSTEXPR_CXX20 bool test40() { test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345"), 0, 1, S("1")); test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345"), 0, 2, S("12")); @@ -4403,10 +4483,12 @@ test(S("abcdefghijklmnopqrst"), 0, 21, SV("1234567890"), 0, 1, S("1")); test(S("abcdefghijklmnopqrst"), 0, 21, SV("1234567890"), 0, 5, S("12345")); test(S("abcdefghijklmnopqrst"), 0, 21, SV("1234567890"), 0, 9, S("123456789")); + + return true; } template -void test41() +TEST_CONSTEXPR_CXX20 bool test41() { test(S("abcdefghijklmnopqrst"), 0, 21, SV("1234567890"), 0, 10, S("1234567890")); test(S("abcdefghijklmnopqrst"), 0, 21, SV("1234567890"), 0, 11, S("1234567890")); @@ -4508,10 +4590,12 @@ test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345678901234567890"), 0, 19, S("a1234567890123456789bcdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345678901234567890"), 0, 20, S("a12345678901234567890bcdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345678901234567890"), 0, 21, S("a12345678901234567890bcdefghijklmnopqrst")); + + return true; } template -void test42() +TEST_CONSTEXPR_CXX20 bool test42() { test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345678901234567890"), 1, 0, S("abcdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345678901234567890"), 1, 1, S("a2bcdefghijklmnopqrst")); @@ -4613,10 +4697,12 @@ test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345"), 0, 2, S("a12klmnopqrst")); test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345"), 0, 4, S("a1234klmnopqrst")); test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345"), 0, 5, S("a12345klmnopqrst")); + + return true; } template -void test43() +TEST_CONSTEXPR_CXX20 bool test43() { test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345"), 0, 6, S("a12345klmnopqrst")); test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345"), 1, 0, S("aklmnopqrst")); @@ -4718,10 +4804,12 @@ test(S("abcdefghijklmnopqrst"), 1, 18, SV("1234567890"), 0, 11, S("a1234567890t")); test(S("abcdefghijklmnopqrst"), 1, 18, SV("1234567890"), 1, 0, S("at")); test(S("abcdefghijklmnopqrst"), 1, 18, SV("1234567890"), 1, 1, S("a2t")); + + return true; } template -void test44() +TEST_CONSTEXPR_CXX20 bool test44() { test(S("abcdefghijklmnopqrst"), 1, 18, SV("1234567890"), 1, 4, S("a2345t")); test(S("abcdefghijklmnopqrst"), 1, 18, SV("1234567890"), 1, 8, S("a23456789t")); @@ -4823,10 +4911,12 @@ test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345678901234567890"), 1, 1, S("a2")); test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345678901234567890"), 1, 9, S("a234567890")); test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345678901234567890"), 1, 18, S("a234567890123456789")); + + return true; } template -void test45() +TEST_CONSTEXPR_CXX20 bool test45() { test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345678901234567890"), 1, 19, S("a2345678901234567890")); test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345678901234567890"), 1, 20, S("a2345678901234567890")); @@ -4928,10 +5018,12 @@ test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345"), 1, 0, S("abcdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345"), 1, 1, S("abcdefghij2klmnopqrst")); test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345"), 1, 2, S("abcdefghij23klmnopqrst")); + + return true; } template -void test46() +TEST_CONSTEXPR_CXX20 bool test46() { test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345"), 1, 3, S("abcdefghij234klmnopqrst")); test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345"), 1, 4, S("abcdefghij2345klmnopqrst")); @@ -5033,10 +5125,12 @@ test(S("abcdefghijklmnopqrst"), 10, 1, SV("1234567890"), 1, 8, S("abcdefghij23456789lmnopqrst")); test(S("abcdefghijklmnopqrst"), 10, 1, SV("1234567890"), 1, 9, S("abcdefghij234567890lmnopqrst")); test(S("abcdefghijklmnopqrst"), 10, 1, SV("1234567890"), 1, 10, S("abcdefghij234567890lmnopqrst")); + + return true; } template -void test47() +TEST_CONSTEXPR_CXX20 bool test47() { test(S("abcdefghijklmnopqrst"), 10, 1, SV("1234567890"), 5, 0, S("abcdefghijlmnopqrst")); test(S("abcdefghijklmnopqrst"), 10, 1, SV("1234567890"), 5, 1, S("abcdefghij6lmnopqrst")); @@ -5138,10 +5232,12 @@ test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345678901234567890"), 1, 20, S("abcdefghij2345678901234567890pqrst")); test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345678901234567890"), 10, 0, S("abcdefghijpqrst")); test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345678901234567890"), 10, 1, S("abcdefghij1pqrst")); + + return true; } template -void test48() +TEST_CONSTEXPR_CXX20 bool test48() { test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345678901234567890"), 10, 5, S("abcdefghij12345pqrst")); test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345678901234567890"), 10, 9, S("abcdefghij123456789pqrst")); @@ -5243,10 +5339,12 @@ test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345"), 1, 4, S("abcdefghij2345")); test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345"), 1, 5, S("abcdefghij2345")); test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345"), 2, 0, S("abcdefghij")); + + return true; } template -void test49() +TEST_CONSTEXPR_CXX20 bool test49() { test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345"), 2, 1, S("abcdefghij3")); test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345"), 2, 2, S("abcdefghij34")); @@ -5348,10 +5446,12 @@ test(S("abcdefghijklmnopqrst"), 10, 11, SV("1234567890"), 5, 1, S("abcdefghij6")); test(S("abcdefghijklmnopqrst"), 10, 11, SV("1234567890"), 5, 2, S("abcdefghij67")); test(S("abcdefghijklmnopqrst"), 10, 11, SV("1234567890"), 5, 4, S("abcdefghij6789")); + + return true; } template -void test50() +TEST_CONSTEXPR_CXX20 bool test50() { test(S("abcdefghijklmnopqrst"), 10, 11, SV("1234567890"), 5, 5, S("abcdefghij67890")); test(S("abcdefghijklmnopqrst"), 10, 11, SV("1234567890"), 5, 6, S("abcdefghij67890")); @@ -5453,10 +5553,12 @@ test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345678901234567890"), 10, 9, S("abcdefghijklmnopqrs123456789t")); test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345678901234567890"), 10, 10, S("abcdefghijklmnopqrs1234567890t")); test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345678901234567890"), 10, 11, S("abcdefghijklmnopqrs1234567890t")); + + return true; } template -void test51() +TEST_CONSTEXPR_CXX20 bool test51() { test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345678901234567890"), 19, 0, S("abcdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345678901234567890"), 19, 1, S("abcdefghijklmnopqrs0t")); @@ -5558,10 +5660,12 @@ test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345"), 2, 2, S("abcdefghijklmnopqrs34")); test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345"), 2, 3, S("abcdefghijklmnopqrs345")); test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345"), 2, 4, S("abcdefghijklmnopqrs345")); + + return true; } template -void test52() +TEST_CONSTEXPR_CXX20 bool test52() { test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345"), 4, 0, S("abcdefghijklmnopqrs")); test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345"), 4, 1, S("abcdefghijklmnopqrs5")); @@ -5663,10 +5767,12 @@ test(S("abcdefghijklmnopqrst"), 20, 0, SV("1234567890"), 5, 6, S("abcdefghijklmnopqrst67890")); test(S("abcdefghijklmnopqrst"), 20, 0, SV("1234567890"), 9, 0, S("abcdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 20, 0, SV("1234567890"), 9, 1, S("abcdefghijklmnopqrst0")); + + return true; } template -void test53() +TEST_CONSTEXPR_CXX20 bool test53() { test(S("abcdefghijklmnopqrst"), 20, 0, SV("1234567890"), 9, 2, S("abcdefghijklmnopqrst0")); test(S("abcdefghijklmnopqrst"), 20, 0, SV("1234567890"), 10, 0, S("abcdefghijklmnopqrst")); @@ -5768,10 +5874,12 @@ test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345678901234567890"), 19, 1, S("abcdefghijklmnopqrst0")); test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345678901234567890"), 19, 2, S("abcdefghijklmnopqrst0")); test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345678901234567890"), 20, 0, S("abcdefghijklmnopqrst")); + + return true; } template -void test54() +TEST_CONSTEXPR_CXX20 bool test54() { test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345678901234567890"), 20, 1, S("abcdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345678901234567890"), 21, 0, S("can't happen")); @@ -5849,10 +5957,12 @@ test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345678901234567890"), 20, 0, S("can't happen")); test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345678901234567890"), 20, 1, S("can't happen")); test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345678901234567890"), 21, 0, S("can't happen")); + + return true; } template -void test55() +TEST_CONSTEXPR_CXX20 bool test55() { test_npos(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 10, S("abcdefghi1234567890")); test_npos(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 19, S("abcdefghi0")); @@ -5867,133 +5977,11 @@ test_npos(S("abcdefghij"), 9, 2, SV("12345"), 4, S("abcdefghi5")); test_npos(S("abcdefghij"), 9, 2, SV("12345"), 5, S("abcdefghi")); test_npos(S("abcdefghij"), 9, 2, SV("12345"), 6, S("can't happen")); + + return true; } -int main(int, char**) -{ - { - typedef std::string S; - typedef std::string_view SV; - test0(); - test1(); - test2(); - test3(); - test4(); - test5(); - test6(); - test7(); - test8(); - test9(); - test10(); - test11(); - test12(); - test13(); - test14(); - test15(); - test16(); - test17(); - test18(); - test19(); - test20(); - test21(); - test22(); - test23(); - test24(); - test25(); - test26(); - test27(); - test28(); - test29(); - test30(); - test31(); - test32(); - test33(); - test34(); - test35(); - test36(); - test37(); - test38(); - test39(); - test40(); - test41(); - test42(); - test43(); - test44(); - test45(); - test46(); - test47(); - test48(); - test49(); - test50(); - test51(); - test52(); - test53(); - test54(); - test55(); - } -#if TEST_STD_VER >= 11 - { - typedef std::basic_string, min_allocator> S; - typedef std::basic_string_view> SV; - test0(); - test1(); - test2(); - test3(); - test4(); - test5(); - test6(); - test7(); - test8(); - test9(); - test10(); - test11(); - test12(); - test13(); - test14(); - test15(); - test16(); - test17(); - test18(); - test19(); - test20(); - test21(); - test22(); - test23(); - test24(); - test25(); - test26(); - test27(); - test28(); - test29(); - test30(); - test31(); - test32(); - test33(); - test34(); - test35(); - test36(); - test37(); - test38(); - test39(); - test40(); - test41(); - test42(); - test43(); - test44(); - test45(); - test46(); - test47(); - test48(); - test49(); - test50(); - test51(); - test52(); - test53(); - test54(); - test55(); - } -#endif - { +bool test56() { typedef std::string S; typedef std::string_view SV; S s0 = "ABCD"; @@ -6024,7 +6012,138 @@ s = s0; s.replace(0, 4, arr, 0, std::string::npos); // calls replace(pos1, n1, string("IJKL"), pos, npos) assert(s == "IJKL"); - } + + return true; +} + +template +bool test() { + test0(); + test1(); + test2(); + test3(); + test4(); + test5(); + test6(); + test7(); + test8(); + test9(); + test10(); + test11(); + test12(); + test13(); + test14(); + test15(); + test16(); + test17(); + test18(); + test19(); + test20(); + test21(); + test22(); + test23(); + test24(); + test25(); + test26(); + test27(); + test28(); + test29(); + test30(); + test31(); + test32(); + test33(); + test34(); + test35(); + test36(); + test37(); + test38(); + test39(); + test40(); + test41(); + test42(); + test43(); + test44(); + test45(); + test46(); + test47(); + test48(); + test49(); + test50(); + test51(); + test52(); + test53(); + test54(); + test55(); + +#if TEST_STD_VER > 17 + // static_assert(test0()); + // static_assert(test1()); + // static_assert(test2()); + // static_assert(test3()); + // static_assert(test4()); + // static_assert(test5()); + // static_assert(test6()); + // static_assert(test7()); + // static_assert(test8()); + // static_assert(test9()); + // static_assert(test10()); + // static_assert(test11()); + // static_assert(test12()); + // static_assert(test13()); + // static_assert(test14()); + // static_assert(test15()); + // static_assert(test16()); + // static_assert(test17()); + // static_assert(test18()); + // static_assert(test19()); + // static_assert(test20()); + // static_assert(test21()); + // static_assert(test22()); + // static_assert(test23()); + // static_assert(test24()); + // static_assert(test25()); + // static_assert(test26()); + // static_assert(test27()); + // static_assert(test28()); + // static_assert(test29()); + // static_assert(test30()); + // static_assert(test31()); + // static_assert(test32()); + // static_assert(test33()); + // static_assert(test34()); + // static_assert(test35()); + // static_assert(test36()); + // static_assert(test37()); + // static_assert(test38()); + // static_assert(test39()); + // static_assert(test40()); + // static_assert(test41()); + // static_assert(test42()); + // static_assert(test43()); + // static_assert(test44()); + // static_assert(test45()); + // static_assert(test46()); + // static_assert(test47()); + // static_assert(test48()); + // static_assert(test49()); + // static_assert(test50()); + // static_assert(test51()); + // static_assert(test52()); + // static_assert(test53()); + // static_assert(test54()); + // static_assert(test55()); +#endif + + return true; +} + +int main(int, char**) +{ + test(); +#if TEST_STD_VER >= 11 + test, min_allocator>, + std::basic_string_view>>(); +#endif return 0; } diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer.pass.cpp @@ -20,7 +20,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(S s, typename S::size_type pos, typename S::size_type n1, const typename S::value_type* str, S expected) { @@ -53,7 +53,7 @@ } template -void test0() +TEST_CONSTEXPR_CXX20 void test0() { test(S(""), 0, 0, "", S("")); test(S(""), 0, 0, "12345", S("12345")); @@ -158,7 +158,7 @@ } template -void test1() +TEST_CONSTEXPR_CXX20 void test1() { test(S("abcde"), 6, 0, "", S("can't happen")); test(S("abcde"), 6, 0, "12345", S("can't happen")); @@ -263,7 +263,7 @@ } template -void test2() +TEST_CONSTEXPR_CXX20 void test2() { test(S("abcdefghijklmnopqrst"), 0, 0, "", S("abcdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 0, 0, "12345", S("12345abcdefghijklmnopqrst")); @@ -363,21 +363,30 @@ test(S("abcdefghijklmnopqrst"), 21, 0, "12345678901234567890", S("can't happen")); } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; test0(); test1(); test2(); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; test0(); test1(); test2(); - } + } +#endif + + return true; +} + +int main(int, char**) +{ + test(); +#if TEST_STD_VER > 17 + // static_assert(test()); #endif return 0; diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer_size.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer_size.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer_size.pass.cpp @@ -20,7 +20,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(S s, typename S::size_type pos, typename S::size_type n1, const typename S::value_type* str, typename S::size_type n2, S expected) @@ -54,7 +54,7 @@ } template -void test0() +TEST_CONSTEXPR_CXX20 bool test0() { test(S(""), 0, 0, "", 0, S("")); test(S(""), 0, 0, "12345", 0, S("")); @@ -156,10 +156,12 @@ test(S("abcde"), 0, 4, "12345", 0, S("e")); test(S("abcde"), 0, 4, "12345", 1, S("1e")); test(S("abcde"), 0, 4, "12345", 2, S("12e")); + + return true; } template -void test1() +TEST_CONSTEXPR_CXX20 bool test1() { test(S("abcde"), 0, 4, "12345", 4, S("1234e")); test(S("abcde"), 0, 4, "12345", 5, S("12345e")); @@ -261,10 +263,12 @@ test(S("abcde"), 1, 3, "12345", 5, S("a12345e")); test(S("abcde"), 1, 3, "1234567890", 0, S("ae")); test(S("abcde"), 1, 3, "1234567890", 1, S("a1e")); + + return true; } template -void test2() +TEST_CONSTEXPR_CXX20 bool test2() { test(S("abcde"), 1, 3, "1234567890", 5, S("a12345e")); test(S("abcde"), 1, 3, "1234567890", 9, S("a123456789e")); @@ -366,10 +370,12 @@ test(S("abcde"), 2, 3, "1234567890", 9, S("ab123456789")); test(S("abcde"), 2, 3, "1234567890", 10, S("ab1234567890")); test(S("abcde"), 2, 3, "12345678901234567890", 0, S("ab")); + + return true; } template -void test3() +TEST_CONSTEXPR_CXX20 bool test3() { test(S("abcde"), 2, 3, "12345678901234567890", 1, S("ab1")); test(S("abcde"), 2, 3, "12345678901234567890", 10, S("ab1234567890")); @@ -471,10 +477,12 @@ test(S("abcde"), 5, 1, "12345678901234567890", 10, S("abcde1234567890")); test(S("abcde"), 5, 1, "12345678901234567890", 19, S("abcde1234567890123456789")); test(S("abcde"), 5, 1, "12345678901234567890", 20, S("abcde12345678901234567890")); + + return true; } template -void test4() +TEST_CONSTEXPR_CXX20 bool test4() { test(S("abcde"), 6, 0, "", 0, S("can't happen")); test(S("abcde"), 6, 0, "12345", 0, S("can't happen")); @@ -576,10 +584,12 @@ test(S("abcdefghij"), 0, 11, "12345", 0, S("")); test(S("abcdefghij"), 0, 11, "12345", 1, S("1")); test(S("abcdefghij"), 0, 11, "12345", 2, S("12")); + + return true; } template -void test5() +TEST_CONSTEXPR_CXX20 bool test5() { test(S("abcdefghij"), 0, 11, "12345", 4, S("1234")); test(S("abcdefghij"), 0, 11, "12345", 5, S("12345")); @@ -681,10 +691,12 @@ test(S("abcdefghij"), 1, 10, "12345", 5, S("a12345")); test(S("abcdefghij"), 1, 10, "1234567890", 0, S("a")); test(S("abcdefghij"), 1, 10, "1234567890", 1, S("a1")); + + return true; } template -void test6() +TEST_CONSTEXPR_CXX20 bool test6() { test(S("abcdefghij"), 1, 10, "1234567890", 5, S("a12345")); test(S("abcdefghij"), 1, 10, "1234567890", 9, S("a123456789")); @@ -786,10 +798,12 @@ test(S("abcdefghij"), 5, 6, "1234567890", 9, S("abcde123456789")); test(S("abcdefghij"), 5, 6, "1234567890", 10, S("abcde1234567890")); test(S("abcdefghij"), 5, 6, "12345678901234567890", 0, S("abcde")); + + return true; } template -void test7() +TEST_CONSTEXPR_CXX20 bool test7() { test(S("abcdefghij"), 5, 6, "12345678901234567890", 1, S("abcde1")); test(S("abcdefghij"), 5, 6, "12345678901234567890", 10, S("abcde1234567890")); @@ -891,10 +905,12 @@ test(S("abcdefghij"), 11, 0, "12345678901234567890", 10, S("can't happen")); test(S("abcdefghij"), 11, 0, "12345678901234567890", 19, S("can't happen")); test(S("abcdefghij"), 11, 0, "12345678901234567890", 20, S("can't happen")); + + return true; } template -void test8() +TEST_CONSTEXPR_CXX20 bool test8() { test(S("abcdefghijklmnopqrst"), 0, 0, "", 0, S("abcdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 0, 0, "12345", 0, S("abcdefghijklmnopqrst")); @@ -996,10 +1012,12 @@ test(S("abcdefghijklmnopqrst"), 1, 0, "12345", 0, S("abcdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 1, 0, "12345", 1, S("a1bcdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 1, 0, "12345", 2, S("a12bcdefghijklmnopqrst")); + + return true; } template -void test9() +TEST_CONSTEXPR_CXX20 bool test9() { test(S("abcdefghijklmnopqrst"), 1, 0, "12345", 4, S("a1234bcdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 1, 0, "12345", 5, S("a12345bcdefghijklmnopqrst")); @@ -1101,10 +1119,12 @@ test(S("abcdefghijklmnopqrst"), 10, 0, "12345", 5, S("abcdefghij12345klmnopqrst")); test(S("abcdefghijklmnopqrst"), 10, 0, "1234567890", 0, S("abcdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 10, 0, "1234567890", 1, S("abcdefghij1klmnopqrst")); + + return true; } template -void test10() +TEST_CONSTEXPR_CXX20 bool test10() { test(S("abcdefghijklmnopqrst"), 10, 0, "1234567890", 5, S("abcdefghij12345klmnopqrst")); test(S("abcdefghijklmnopqrst"), 10, 0, "1234567890", 9, S("abcdefghij123456789klmnopqrst")); @@ -1206,10 +1226,12 @@ test(S("abcdefghijklmnopqrst"), 19, 0, "1234567890", 9, S("abcdefghijklmnopqrs123456789t")); test(S("abcdefghijklmnopqrst"), 19, 0, "1234567890", 10, S("abcdefghijklmnopqrs1234567890t")); test(S("abcdefghijklmnopqrst"), 19, 0, "12345678901234567890", 0, S("abcdefghijklmnopqrst")); + + return true; } template -void test11() +TEST_CONSTEXPR_CXX20 bool test11() { test(S("abcdefghijklmnopqrst"), 19, 0, "12345678901234567890", 1, S("abcdefghijklmnopqrs1t")); test(S("abcdefghijklmnopqrst"), 19, 0, "12345678901234567890", 10, S("abcdefghijklmnopqrs1234567890t")); @@ -1295,41 +1317,46 @@ test(S("abcdefghijklmnopqrst"), 21, 0, "12345678901234567890", 10, S("can't happen")); test(S("abcdefghijklmnopqrst"), 21, 0, "12345678901234567890", 19, S("can't happen")); test(S("abcdefghijklmnopqrst"), 21, 0, "12345678901234567890", 20, S("can't happen")); + + return true; +} + +template +void test() { + test0(); + test1(); + test2(); + test3(); + test4(); + test5(); + test6(); + test7(); + test8(); + test9(); + test10(); + test11(); + +#if TEST_STD_VER > 17 + // static_assert(test0()); + // static_assert(test1()); + // static_assert(test2()); + // static_assert(test3()); + // static_assert(test4()); + // static_assert(test5()); + // static_assert(test6()); + // static_assert(test7()); + // static_assert(test8()); + // static_assert(test9()); + // static_assert(test10()); + // static_assert(test11()); +#endif } int main(int, char**) { - { - typedef std::string S; - test0(); - test1(); - test2(); - test3(); - test4(); - test5(); - test6(); - test7(); - test8(); - test9(); - test10(); - test11(); - } + test(); #if TEST_STD_VER >= 11 - { - typedef std::basic_string, min_allocator> S; - test0(); - test1(); - test2(); - test3(); - test4(); - test5(); - test6(); - test7(); - test8(); - test9(); - test10(); - test11(); - } + test, min_allocator>>(); #endif return 0; diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_size_char.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_size_char.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_size_char.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_size_char.pass.cpp @@ -20,7 +20,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(S s, typename S::size_type pos, typename S::size_type n1, typename S::size_type n2, typename S::value_type c, S expected) @@ -54,7 +54,7 @@ } template -void test0() +TEST_CONSTEXPR_CXX20 void test0() { test(S(""), 0, 0, 0, '2', S("")); test(S(""), 0, 0, 5, '2', S("22222")); @@ -159,7 +159,7 @@ } template -void test1() +TEST_CONSTEXPR_CXX20 void test1() { test(S("abcde"), 6, 0, 0, '2', S("can't happen")); test(S("abcde"), 6, 0, 5, '2', S("can't happen")); @@ -264,7 +264,7 @@ } template -void test2() +TEST_CONSTEXPR_CXX20 void test2() { test(S("abcdefghijklmnopqrst"), 0, 0, 0, '2', S("abcdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 0, 0, 5, '2', S("22222abcdefghijklmnopqrst")); @@ -364,8 +364,7 @@ test(S("abcdefghijklmnopqrst"), 21, 0, 20, '2', S("can't happen")); } -int main(int, char**) -{ +bool test() { { typedef std::string S; test0(); @@ -381,5 +380,15 @@ } #endif + return true; +} + +int main(int, char**) +{ + test(); +#if TEST_STD_VER > 17 + // static_assert(test()); +#endif + return 0; } diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string.pass.cpp @@ -20,7 +20,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(S s, typename S::size_type pos1, typename S::size_type n1, S str, S expected) { const typename S::size_type old_size = s.size(); @@ -52,7 +52,7 @@ } template -void test0() +TEST_CONSTEXPR_CXX20 void test0() { test(S(""), 0, 0, S(""), S("")); test(S(""), 0, 0, S("12345"), S("12345")); @@ -157,7 +157,7 @@ } template -void test1() +TEST_CONSTEXPR_CXX20 void test1() { test(S("abcde"), 6, 0, S(""), S("can't happen")); test(S("abcde"), 6, 0, S("12345"), S("can't happen")); @@ -262,7 +262,7 @@ } template -void test2() +TEST_CONSTEXPR_CXX20 void test2() { test(S("abcdefghijklmnopqrst"), 0, 0, S(""), S("abcdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 0, 0, S("12345"), S("12345abcdefghijklmnopqrst")); @@ -362,30 +362,39 @@ test(S("abcdefghijklmnopqrst"), 21, 0, S("12345678901234567890"), S("can't happen")); } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; test0(); test1(); test2(); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; test0(); test1(); test2(); - } + } #endif #if TEST_STD_VER > 3 - { // LWG 2946 + { // LWG 2946 std::string s = " "; s.replace(0, 1, {"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; diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_size_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_size_size.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_size_size.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_size_size.pass.cpp @@ -22,7 +22,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(S s, typename S::size_type pos1, typename S::size_type n1, S str, typename S::size_type pos2, typename S::size_type n2, S expected) @@ -56,7 +56,7 @@ } template -void +TEST_CONSTEXPR_CXX20 void test_npos(S s, typename S::size_type pos1, typename S::size_type n1, S str, typename S::size_type pos2, S expected) @@ -91,7 +91,7 @@ template -void test0() +TEST_CONSTEXPR_CXX20 bool test0() { test(S(""), 0, 0, S(""), 0, 0, S("")); test(S(""), 0, 0, S(""), 0, 1, S("")); @@ -193,10 +193,12 @@ test(S(""), 0, 1, S("12345"), 5, 0, S("")); test(S(""), 0, 1, S("12345"), 5, 1, S("")); test(S(""), 0, 1, S("12345"), 6, 0, S("can't happen")); + + return true; } template -void test1() +TEST_CONSTEXPR_CXX20 bool test1() { test(S(""), 0, 1, S("1234567890"), 0, 0, S("")); test(S(""), 0, 1, S("1234567890"), 0, 1, S("1")); @@ -298,10 +300,12 @@ test(S(""), 1, 0, S("1234567890"), 11, 0, S("can't happen")); test(S(""), 1, 0, S("12345678901234567890"), 0, 0, S("can't happen")); test(S(""), 1, 0, S("12345678901234567890"), 0, 1, S("can't happen")); + + return true; } template -void test2() +TEST_CONSTEXPR_CXX20 bool test2() { test(S(""), 1, 0, S("12345678901234567890"), 0, 10, S("can't happen")); test(S(""), 1, 0, S("12345678901234567890"), 0, 19, S("can't happen")); @@ -403,10 +407,12 @@ test(S("abcde"), 0, 1, S(""), 0, 1, S("bcde")); test(S("abcde"), 0, 1, S(""), 1, 0, S("can't happen")); test(S("abcde"), 0, 1, S("12345"), 0, 0, S("bcde")); + + return true; } template -void test3() +TEST_CONSTEXPR_CXX20 bool test3() { test(S("abcde"), 0, 1, S("12345"), 0, 1, S("1bcde")); test(S("abcde"), 0, 1, S("12345"), 0, 2, S("12bcde")); @@ -508,10 +514,12 @@ test(S("abcde"), 0, 2, S("1234567890"), 0, 1, S("1cde")); test(S("abcde"), 0, 2, S("1234567890"), 0, 5, S("12345cde")); test(S("abcde"), 0, 2, S("1234567890"), 0, 9, S("123456789cde")); + + return true; } template -void test4() +TEST_CONSTEXPR_CXX20 bool test4() { test(S("abcde"), 0, 2, S("1234567890"), 0, 10, S("1234567890cde")); test(S("abcde"), 0, 2, S("1234567890"), 0, 11, S("1234567890cde")); @@ -613,10 +621,12 @@ test(S("abcde"), 0, 4, S("12345678901234567890"), 0, 19, S("1234567890123456789e")); test(S("abcde"), 0, 4, S("12345678901234567890"), 0, 20, S("12345678901234567890e")); test(S("abcde"), 0, 4, S("12345678901234567890"), 0, 21, S("12345678901234567890e")); + + return true; } template -void test5() +TEST_CONSTEXPR_CXX20 bool test5() { test(S("abcde"), 0, 4, S("12345678901234567890"), 1, 0, S("e")); test(S("abcde"), 0, 4, S("12345678901234567890"), 1, 1, S("2e")); @@ -718,10 +728,12 @@ test(S("abcde"), 0, 6, S("12345"), 0, 2, S("12")); test(S("abcde"), 0, 6, S("12345"), 0, 4, S("1234")); test(S("abcde"), 0, 6, S("12345"), 0, 5, S("12345")); + + return true; } template -void test6() +TEST_CONSTEXPR_CXX20 bool test6() { test(S("abcde"), 0, 6, S("12345"), 0, 6, S("12345")); test(S("abcde"), 0, 6, S("12345"), 1, 0, S("")); @@ -823,10 +835,12 @@ test(S("abcde"), 1, 0, S("1234567890"), 0, 11, S("a1234567890bcde")); test(S("abcde"), 1, 0, S("1234567890"), 1, 0, S("abcde")); test(S("abcde"), 1, 0, S("1234567890"), 1, 1, S("a2bcde")); + + return true; } template -void test7() +TEST_CONSTEXPR_CXX20 bool test7() { test(S("abcde"), 1, 0, S("1234567890"), 1, 4, S("a2345bcde")); test(S("abcde"), 1, 0, S("1234567890"), 1, 8, S("a23456789bcde")); @@ -928,10 +942,12 @@ test(S("abcde"), 1, 1, S("12345678901234567890"), 1, 1, S("a2cde")); test(S("abcde"), 1, 1, S("12345678901234567890"), 1, 9, S("a234567890cde")); test(S("abcde"), 1, 1, S("12345678901234567890"), 1, 18, S("a234567890123456789cde")); + + return true; } template -void test8() +TEST_CONSTEXPR_CXX20 bool test8() { test(S("abcde"), 1, 1, S("12345678901234567890"), 1, 19, S("a2345678901234567890cde")); test(S("abcde"), 1, 1, S("12345678901234567890"), 1, 20, S("a2345678901234567890cde")); @@ -1033,10 +1049,12 @@ test(S("abcde"), 1, 3, S("12345"), 1, 0, S("ae")); test(S("abcde"), 1, 3, S("12345"), 1, 1, S("a2e")); test(S("abcde"), 1, 3, S("12345"), 1, 2, S("a23e")); + + return true; } template -void test9() +TEST_CONSTEXPR_CXX20 bool test9() { test(S("abcde"), 1, 3, S("12345"), 1, 3, S("a234e")); test(S("abcde"), 1, 3, S("12345"), 1, 4, S("a2345e")); @@ -1138,10 +1156,12 @@ test(S("abcde"), 1, 4, S("1234567890"), 1, 8, S("a23456789")); test(S("abcde"), 1, 4, S("1234567890"), 1, 9, S("a234567890")); test(S("abcde"), 1, 4, S("1234567890"), 1, 10, S("a234567890")); + + return true; } template -void test10() +TEST_CONSTEXPR_CXX20 bool test10() { test(S("abcde"), 1, 4, S("1234567890"), 5, 0, S("a")); test(S("abcde"), 1, 4, S("1234567890"), 5, 1, S("a6")); @@ -1243,10 +1263,12 @@ test(S("abcde"), 1, 5, S("12345678901234567890"), 1, 20, S("a2345678901234567890")); test(S("abcde"), 1, 5, S("12345678901234567890"), 10, 0, S("a")); test(S("abcde"), 1, 5, S("12345678901234567890"), 10, 1, S("a1")); + + return true; } template -void test11() +TEST_CONSTEXPR_CXX20 bool test11() { test(S("abcde"), 1, 5, S("12345678901234567890"), 10, 5, S("a12345")); test(S("abcde"), 1, 5, S("12345678901234567890"), 10, 9, S("a123456789")); @@ -1348,10 +1370,12 @@ test(S("abcde"), 2, 1, S("12345"), 1, 4, S("ab2345de")); test(S("abcde"), 2, 1, S("12345"), 1, 5, S("ab2345de")); test(S("abcde"), 2, 1, S("12345"), 2, 0, S("abde")); + + return true; } template -void test12() +TEST_CONSTEXPR_CXX20 bool test12() { test(S("abcde"), 2, 1, S("12345"), 2, 1, S("ab3de")); test(S("abcde"), 2, 1, S("12345"), 2, 2, S("ab34de")); @@ -1453,10 +1477,12 @@ test(S("abcde"), 2, 2, S("1234567890"), 5, 1, S("ab6e")); test(S("abcde"), 2, 2, S("1234567890"), 5, 2, S("ab67e")); test(S("abcde"), 2, 2, S("1234567890"), 5, 4, S("ab6789e")); + + return true; } template -void test13() +TEST_CONSTEXPR_CXX20 bool test13() { test(S("abcde"), 2, 2, S("1234567890"), 5, 5, S("ab67890e")); test(S("abcde"), 2, 2, S("1234567890"), 5, 6, S("ab67890e")); @@ -1558,10 +1584,12 @@ test(S("abcde"), 2, 3, S("12345678901234567890"), 10, 9, S("ab123456789")); test(S("abcde"), 2, 3, S("12345678901234567890"), 10, 10, S("ab1234567890")); test(S("abcde"), 2, 3, S("12345678901234567890"), 10, 11, S("ab1234567890")); + + return true; } template -void test14() +TEST_CONSTEXPR_CXX20 bool test14() { test(S("abcde"), 2, 3, S("12345678901234567890"), 19, 0, S("ab")); test(S("abcde"), 2, 3, S("12345678901234567890"), 19, 1, S("ab0")); @@ -1663,10 +1691,12 @@ test(S("abcde"), 4, 0, S("12345"), 2, 2, S("abcd34e")); test(S("abcde"), 4, 0, S("12345"), 2, 3, S("abcd345e")); test(S("abcde"), 4, 0, S("12345"), 2, 4, S("abcd345e")); + + return true; } template -void test15() +TEST_CONSTEXPR_CXX20 bool test15() { test(S("abcde"), 4, 0, S("12345"), 4, 0, S("abcde")); test(S("abcde"), 4, 0, S("12345"), 4, 1, S("abcd5e")); @@ -1768,10 +1798,12 @@ test(S("abcde"), 4, 1, S("1234567890"), 5, 6, S("abcd67890")); test(S("abcde"), 4, 1, S("1234567890"), 9, 0, S("abcd")); test(S("abcde"), 4, 1, S("1234567890"), 9, 1, S("abcd0")); + + return true; } template -void test16() +TEST_CONSTEXPR_CXX20 bool test16() { test(S("abcde"), 4, 1, S("1234567890"), 9, 2, S("abcd0")); test(S("abcde"), 4, 1, S("1234567890"), 10, 0, S("abcd")); @@ -1873,10 +1905,12 @@ test(S("abcde"), 4, 2, S("12345678901234567890"), 19, 1, S("abcd0")); test(S("abcde"), 4, 2, S("12345678901234567890"), 19, 2, S("abcd0")); test(S("abcde"), 4, 2, S("12345678901234567890"), 20, 0, S("abcd")); + + return true; } template -void test17() +TEST_CONSTEXPR_CXX20 bool test17() { test(S("abcde"), 4, 2, S("12345678901234567890"), 20, 1, S("abcd")); test(S("abcde"), 4, 2, S("12345678901234567890"), 21, 0, S("can't happen")); @@ -1978,10 +2012,12 @@ test(S("abcde"), 5, 1, S("12345"), 4, 1, S("abcde5")); test(S("abcde"), 5, 1, S("12345"), 4, 2, S("abcde5")); test(S("abcde"), 5, 1, S("12345"), 5, 0, S("abcde")); + + return true; } template -void test18() +TEST_CONSTEXPR_CXX20 bool test18() { test(S("abcde"), 5, 1, S("12345"), 5, 1, S("abcde")); test(S("abcde"), 5, 1, S("12345"), 6, 0, S("can't happen")); @@ -2083,10 +2119,12 @@ test(S("abcde"), 6, 0, S("1234567890"), 10, 0, S("can't happen")); test(S("abcde"), 6, 0, S("1234567890"), 10, 1, S("can't happen")); test(S("abcde"), 6, 0, S("1234567890"), 11, 0, S("can't happen")); + + return true; } template -void test19() +TEST_CONSTEXPR_CXX20 bool test19() { test(S("abcde"), 6, 0, S("12345678901234567890"), 0, 0, S("can't happen")); test(S("abcde"), 6, 0, S("12345678901234567890"), 0, 1, S("can't happen")); @@ -2188,10 +2226,12 @@ test(S("abcdefghij"), 0, 0, S("12345678901234567890"), 21, 0, S("can't happen")); test(S("abcdefghij"), 0, 1, S(""), 0, 0, S("bcdefghij")); test(S("abcdefghij"), 0, 1, S(""), 0, 1, S("bcdefghij")); + + return true; } template -void test20() +TEST_CONSTEXPR_CXX20 bool test20() { test(S("abcdefghij"), 0, 1, S(""), 1, 0, S("can't happen")); test(S("abcdefghij"), 0, 1, S("12345"), 0, 0, S("bcdefghij")); @@ -2293,10 +2333,12 @@ test(S("abcdefghij"), 0, 5, S("12345"), 6, 0, S("can't happen")); test(S("abcdefghij"), 0, 5, S("1234567890"), 0, 0, S("fghij")); test(S("abcdefghij"), 0, 5, S("1234567890"), 0, 1, S("1fghij")); + + return true; } template -void test21() +TEST_CONSTEXPR_CXX20 bool test21() { test(S("abcdefghij"), 0, 5, S("1234567890"), 0, 5, S("12345fghij")); test(S("abcdefghij"), 0, 5, S("1234567890"), 0, 9, S("123456789fghij")); @@ -2398,10 +2440,12 @@ test(S("abcdefghij"), 0, 9, S("12345678901234567890"), 0, 1, S("1j")); test(S("abcdefghij"), 0, 9, S("12345678901234567890"), 0, 10, S("1234567890j")); test(S("abcdefghij"), 0, 9, S("12345678901234567890"), 0, 19, S("1234567890123456789j")); + + return true; } template -void test22() +TEST_CONSTEXPR_CXX20 bool test22() { test(S("abcdefghij"), 0, 9, S("12345678901234567890"), 0, 20, S("12345678901234567890j")); test(S("abcdefghij"), 0, 9, S("12345678901234567890"), 0, 21, S("12345678901234567890j")); @@ -2503,10 +2547,12 @@ test(S("abcdefghij"), 0, 11, S("12345"), 0, 0, S("")); test(S("abcdefghij"), 0, 11, S("12345"), 0, 1, S("1")); test(S("abcdefghij"), 0, 11, S("12345"), 0, 2, S("12")); + + return true; } template -void test23() +TEST_CONSTEXPR_CXX20 bool test23() { test(S("abcdefghij"), 0, 11, S("12345"), 0, 4, S("1234")); test(S("abcdefghij"), 0, 11, S("12345"), 0, 5, S("12345")); @@ -2608,10 +2654,12 @@ test(S("abcdefghij"), 1, 0, S("1234567890"), 0, 9, S("a123456789bcdefghij")); test(S("abcdefghij"), 1, 0, S("1234567890"), 0, 10, S("a1234567890bcdefghij")); test(S("abcdefghij"), 1, 0, S("1234567890"), 0, 11, S("a1234567890bcdefghij")); + + return true; } template -void test24() +TEST_CONSTEXPR_CXX20 bool test24() { test(S("abcdefghij"), 1, 0, S("1234567890"), 1, 0, S("abcdefghij")); test(S("abcdefghij"), 1, 0, S("1234567890"), 1, 1, S("a2bcdefghij")); @@ -2713,10 +2761,12 @@ test(S("abcdefghij"), 1, 1, S("12345678901234567890"), 0, 21, S("a12345678901234567890cdefghij")); test(S("abcdefghij"), 1, 1, S("12345678901234567890"), 1, 0, S("acdefghij")); test(S("abcdefghij"), 1, 1, S("12345678901234567890"), 1, 1, S("a2cdefghij")); + + return true; } template -void test25() +TEST_CONSTEXPR_CXX20 bool test25() { test(S("abcdefghij"), 1, 1, S("12345678901234567890"), 1, 9, S("a234567890cdefghij")); test(S("abcdefghij"), 1, 1, S("12345678901234567890"), 1, 18, S("a234567890123456789cdefghij")); @@ -2818,10 +2868,12 @@ test(S("abcdefghij"), 1, 8, S("12345"), 0, 5, S("a12345j")); test(S("abcdefghij"), 1, 8, S("12345"), 0, 6, S("a12345j")); test(S("abcdefghij"), 1, 8, S("12345"), 1, 0, S("aj")); + + return true; } template -void test26() +TEST_CONSTEXPR_CXX20 bool test26() { test(S("abcdefghij"), 1, 8, S("12345"), 1, 1, S("a2j")); test(S("abcdefghij"), 1, 8, S("12345"), 1, 2, S("a23j")); @@ -2923,10 +2975,12 @@ test(S("abcdefghij"), 1, 9, S("1234567890"), 1, 1, S("a2")); test(S("abcdefghij"), 1, 9, S("1234567890"), 1, 4, S("a2345")); test(S("abcdefghij"), 1, 9, S("1234567890"), 1, 8, S("a23456789")); + + return true; } template -void test27() +TEST_CONSTEXPR_CXX20 bool test27() { test(S("abcdefghij"), 1, 9, S("1234567890"), 1, 9, S("a234567890")); test(S("abcdefghij"), 1, 9, S("1234567890"), 1, 10, S("a234567890")); @@ -3028,10 +3082,12 @@ test(S("abcdefghij"), 1, 10, S("12345678901234567890"), 1, 18, S("a234567890123456789")); test(S("abcdefghij"), 1, 10, S("12345678901234567890"), 1, 19, S("a2345678901234567890")); test(S("abcdefghij"), 1, 10, S("12345678901234567890"), 1, 20, S("a2345678901234567890")); + + return true; } template -void test28() +TEST_CONSTEXPR_CXX20 bool test28() { test(S("abcdefghij"), 1, 10, S("12345678901234567890"), 10, 0, S("a")); test(S("abcdefghij"), 1, 10, S("12345678901234567890"), 10, 1, S("a1")); @@ -3133,10 +3189,12 @@ test(S("abcdefghij"), 5, 1, S("12345"), 1, 2, S("abcde23ghij")); test(S("abcdefghij"), 5, 1, S("12345"), 1, 3, S("abcde234ghij")); test(S("abcdefghij"), 5, 1, S("12345"), 1, 4, S("abcde2345ghij")); + + return true; } template -void test29() +TEST_CONSTEXPR_CXX20 bool test29() { test(S("abcdefghij"), 5, 1, S("12345"), 1, 5, S("abcde2345ghij")); test(S("abcdefghij"), 5, 1, S("12345"), 2, 0, S("abcdeghij")); @@ -3238,10 +3296,12 @@ test(S("abcdefghij"), 5, 2, S("1234567890"), 1, 10, S("abcde234567890hij")); test(S("abcdefghij"), 5, 2, S("1234567890"), 5, 0, S("abcdehij")); test(S("abcdefghij"), 5, 2, S("1234567890"), 5, 1, S("abcde6hij")); + + return true; } template -void test30() +TEST_CONSTEXPR_CXX20 bool test30() { test(S("abcdefghij"), 5, 2, S("1234567890"), 5, 2, S("abcde67hij")); test(S("abcdefghij"), 5, 2, S("1234567890"), 5, 4, S("abcde6789hij")); @@ -3343,10 +3403,12 @@ test(S("abcdefghij"), 5, 4, S("12345678901234567890"), 10, 1, S("abcde1j")); test(S("abcdefghij"), 5, 4, S("12345678901234567890"), 10, 5, S("abcde12345j")); test(S("abcdefghij"), 5, 4, S("12345678901234567890"), 10, 9, S("abcde123456789j")); + + return true; } template -void test31() +TEST_CONSTEXPR_CXX20 bool test31() { test(S("abcdefghij"), 5, 4, S("12345678901234567890"), 10, 10, S("abcde1234567890j")); test(S("abcdefghij"), 5, 4, S("12345678901234567890"), 10, 11, S("abcde1234567890j")); @@ -3448,10 +3510,12 @@ test(S("abcdefghij"), 5, 6, S("12345"), 2, 0, S("abcde")); test(S("abcdefghij"), 5, 6, S("12345"), 2, 1, S("abcde3")); test(S("abcdefghij"), 5, 6, S("12345"), 2, 2, S("abcde34")); + + return true; } template -void test32() +TEST_CONSTEXPR_CXX20 bool test32() { test(S("abcdefghij"), 5, 6, S("12345"), 2, 3, S("abcde345")); test(S("abcdefghij"), 5, 6, S("12345"), 2, 4, S("abcde345")); @@ -3553,10 +3617,12 @@ test(S("abcdefghij"), 9, 0, S("1234567890"), 5, 4, S("abcdefghi6789j")); test(S("abcdefghij"), 9, 0, S("1234567890"), 5, 5, S("abcdefghi67890j")); test(S("abcdefghij"), 9, 0, S("1234567890"), 5, 6, S("abcdefghi67890j")); + + return true; } template -void test33() +TEST_CONSTEXPR_CXX20 bool test33() { test(S("abcdefghij"), 9, 0, S("1234567890"), 9, 0, S("abcdefghij")); test(S("abcdefghij"), 9, 0, S("1234567890"), 9, 1, S("abcdefghi0j")); @@ -3658,10 +3724,12 @@ test(S("abcdefghij"), 9, 1, S("12345678901234567890"), 10, 11, S("abcdefghi1234567890")); test(S("abcdefghij"), 9, 1, S("12345678901234567890"), 19, 0, S("abcdefghi")); test(S("abcdefghij"), 9, 1, S("12345678901234567890"), 19, 1, S("abcdefghi0")); + + return true; } template -void test34() +TEST_CONSTEXPR_CXX20 bool test34() { test(S("abcdefghij"), 9, 1, S("12345678901234567890"), 19, 2, S("abcdefghi0")); test(S("abcdefghij"), 9, 1, S("12345678901234567890"), 20, 0, S("abcdefghi")); @@ -3763,10 +3831,12 @@ test(S("abcdefghij"), 10, 0, S("12345"), 2, 4, S("abcdefghij345")); test(S("abcdefghij"), 10, 0, S("12345"), 4, 0, S("abcdefghij")); test(S("abcdefghij"), 10, 0, S("12345"), 4, 1, S("abcdefghij5")); + + return true; } template -void test35() +TEST_CONSTEXPR_CXX20 bool test35() { test(S("abcdefghij"), 10, 0, S("12345"), 4, 2, S("abcdefghij5")); test(S("abcdefghij"), 10, 0, S("12345"), 5, 0, S("abcdefghij")); @@ -3868,10 +3938,12 @@ test(S("abcdefghij"), 10, 1, S("1234567890"), 9, 1, S("abcdefghij0")); test(S("abcdefghij"), 10, 1, S("1234567890"), 9, 2, S("abcdefghij0")); test(S("abcdefghij"), 10, 1, S("1234567890"), 10, 0, S("abcdefghij")); + + return true; } template -void test36() +TEST_CONSTEXPR_CXX20 bool test36() { test(S("abcdefghij"), 10, 1, S("1234567890"), 10, 1, S("abcdefghij")); test(S("abcdefghij"), 10, 1, S("1234567890"), 11, 0, S("can't happen")); @@ -3973,10 +4045,12 @@ test(S("abcdefghij"), 11, 0, S("12345678901234567890"), 20, 0, S("can't happen")); test(S("abcdefghij"), 11, 0, S("12345678901234567890"), 20, 1, S("can't happen")); test(S("abcdefghij"), 11, 0, S("12345678901234567890"), 21, 0, S("can't happen")); + + return true; } template -void test37() +TEST_CONSTEXPR_CXX20 bool test37() { test(S("abcdefghijklmnopqrst"), 0, 0, S(""), 0, 0, S("abcdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 0, 0, S(""), 0, 1, S("abcdefghijklmnopqrst")); @@ -4078,10 +4152,12 @@ test(S("abcdefghijklmnopqrst"), 0, 1, S("12345"), 5, 0, S("bcdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 0, 1, S("12345"), 5, 1, S("bcdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 0, 1, S("12345"), 6, 0, S("can't happen")); + + return true; } template -void test38() +TEST_CONSTEXPR_CXX20 bool test38() { test(S("abcdefghijklmnopqrst"), 0, 1, S("1234567890"), 0, 0, S("bcdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 0, 1, S("1234567890"), 0, 1, S("1bcdefghijklmnopqrst")); @@ -4183,10 +4259,12 @@ test(S("abcdefghijklmnopqrst"), 0, 10, S("1234567890"), 11, 0, S("can't happen")); test(S("abcdefghijklmnopqrst"), 0, 10, S("12345678901234567890"), 0, 0, S("klmnopqrst")); test(S("abcdefghijklmnopqrst"), 0, 10, S("12345678901234567890"), 0, 1, S("1klmnopqrst")); + + return true; } template -void test39() +TEST_CONSTEXPR_CXX20 bool test39() { test(S("abcdefghijklmnopqrst"), 0, 10, S("12345678901234567890"), 0, 10, S("1234567890klmnopqrst")); test(S("abcdefghijklmnopqrst"), 0, 10, S("12345678901234567890"), 0, 19, S("1234567890123456789klmnopqrst")); @@ -4288,10 +4366,12 @@ test(S("abcdefghijklmnopqrst"), 0, 20, S(""), 0, 1, S("")); test(S("abcdefghijklmnopqrst"), 0, 20, S(""), 1, 0, S("can't happen")); test(S("abcdefghijklmnopqrst"), 0, 20, S("12345"), 0, 0, S("")); + + return true; } template -void test40() +TEST_CONSTEXPR_CXX20 bool test40() { test(S("abcdefghijklmnopqrst"), 0, 20, S("12345"), 0, 1, S("1")); test(S("abcdefghijklmnopqrst"), 0, 20, S("12345"), 0, 2, S("12")); @@ -4393,10 +4473,12 @@ test(S("abcdefghijklmnopqrst"), 0, 21, S("1234567890"), 0, 1, S("1")); test(S("abcdefghijklmnopqrst"), 0, 21, S("1234567890"), 0, 5, S("12345")); test(S("abcdefghijklmnopqrst"), 0, 21, S("1234567890"), 0, 9, S("123456789")); + + return true; } template -void test41() +TEST_CONSTEXPR_CXX20 bool test41() { test(S("abcdefghijklmnopqrst"), 0, 21, S("1234567890"), 0, 10, S("1234567890")); test(S("abcdefghijklmnopqrst"), 0, 21, S("1234567890"), 0, 11, S("1234567890")); @@ -4498,10 +4580,12 @@ test(S("abcdefghijklmnopqrst"), 1, 0, S("12345678901234567890"), 0, 19, S("a1234567890123456789bcdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 1, 0, S("12345678901234567890"), 0, 20, S("a12345678901234567890bcdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 1, 0, S("12345678901234567890"), 0, 21, S("a12345678901234567890bcdefghijklmnopqrst")); + + return true; } template -void test42() +TEST_CONSTEXPR_CXX20 bool test42() { test(S("abcdefghijklmnopqrst"), 1, 0, S("12345678901234567890"), 1, 0, S("abcdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 1, 0, S("12345678901234567890"), 1, 1, S("a2bcdefghijklmnopqrst")); @@ -4603,10 +4687,12 @@ test(S("abcdefghijklmnopqrst"), 1, 9, S("12345"), 0, 2, S("a12klmnopqrst")); test(S("abcdefghijklmnopqrst"), 1, 9, S("12345"), 0, 4, S("a1234klmnopqrst")); test(S("abcdefghijklmnopqrst"), 1, 9, S("12345"), 0, 5, S("a12345klmnopqrst")); + + return true; } template -void test43() +TEST_CONSTEXPR_CXX20 bool test43() { test(S("abcdefghijklmnopqrst"), 1, 9, S("12345"), 0, 6, S("a12345klmnopqrst")); test(S("abcdefghijklmnopqrst"), 1, 9, S("12345"), 1, 0, S("aklmnopqrst")); @@ -4708,10 +4794,12 @@ test(S("abcdefghijklmnopqrst"), 1, 18, S("1234567890"), 0, 11, S("a1234567890t")); test(S("abcdefghijklmnopqrst"), 1, 18, S("1234567890"), 1, 0, S("at")); test(S("abcdefghijklmnopqrst"), 1, 18, S("1234567890"), 1, 1, S("a2t")); + + return true; } template -void test44() +TEST_CONSTEXPR_CXX20 bool test44() { test(S("abcdefghijklmnopqrst"), 1, 18, S("1234567890"), 1, 4, S("a2345t")); test(S("abcdefghijklmnopqrst"), 1, 18, S("1234567890"), 1, 8, S("a23456789t")); @@ -4813,10 +4901,12 @@ test(S("abcdefghijklmnopqrst"), 1, 19, S("12345678901234567890"), 1, 1, S("a2")); test(S("abcdefghijklmnopqrst"), 1, 19, S("12345678901234567890"), 1, 9, S("a234567890")); test(S("abcdefghijklmnopqrst"), 1, 19, S("12345678901234567890"), 1, 18, S("a234567890123456789")); + + return true; } template -void test45() +TEST_CONSTEXPR_CXX20 bool test45() { test(S("abcdefghijklmnopqrst"), 1, 19, S("12345678901234567890"), 1, 19, S("a2345678901234567890")); test(S("abcdefghijklmnopqrst"), 1, 19, S("12345678901234567890"), 1, 20, S("a2345678901234567890")); @@ -4918,10 +5008,12 @@ test(S("abcdefghijklmnopqrst"), 10, 0, S("12345"), 1, 0, S("abcdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 10, 0, S("12345"), 1, 1, S("abcdefghij2klmnopqrst")); test(S("abcdefghijklmnopqrst"), 10, 0, S("12345"), 1, 2, S("abcdefghij23klmnopqrst")); + + return true; } template -void test46() +TEST_CONSTEXPR_CXX20 bool test46() { test(S("abcdefghijklmnopqrst"), 10, 0, S("12345"), 1, 3, S("abcdefghij234klmnopqrst")); test(S("abcdefghijklmnopqrst"), 10, 0, S("12345"), 1, 4, S("abcdefghij2345klmnopqrst")); @@ -5023,10 +5115,12 @@ test(S("abcdefghijklmnopqrst"), 10, 1, S("1234567890"), 1, 8, S("abcdefghij23456789lmnopqrst")); test(S("abcdefghijklmnopqrst"), 10, 1, S("1234567890"), 1, 9, S("abcdefghij234567890lmnopqrst")); test(S("abcdefghijklmnopqrst"), 10, 1, S("1234567890"), 1, 10, S("abcdefghij234567890lmnopqrst")); + + return true; } template -void test47() +TEST_CONSTEXPR_CXX20 bool test47() { test(S("abcdefghijklmnopqrst"), 10, 1, S("1234567890"), 5, 0, S("abcdefghijlmnopqrst")); test(S("abcdefghijklmnopqrst"), 10, 1, S("1234567890"), 5, 1, S("abcdefghij6lmnopqrst")); @@ -5128,10 +5222,12 @@ test(S("abcdefghijklmnopqrst"), 10, 5, S("12345678901234567890"), 1, 20, S("abcdefghij2345678901234567890pqrst")); test(S("abcdefghijklmnopqrst"), 10, 5, S("12345678901234567890"), 10, 0, S("abcdefghijpqrst")); test(S("abcdefghijklmnopqrst"), 10, 5, S("12345678901234567890"), 10, 1, S("abcdefghij1pqrst")); + + return true; } template -void test48() +TEST_CONSTEXPR_CXX20 bool test48() { test(S("abcdefghijklmnopqrst"), 10, 5, S("12345678901234567890"), 10, 5, S("abcdefghij12345pqrst")); test(S("abcdefghijklmnopqrst"), 10, 5, S("12345678901234567890"), 10, 9, S("abcdefghij123456789pqrst")); @@ -5233,10 +5329,12 @@ test(S("abcdefghijklmnopqrst"), 10, 10, S("12345"), 1, 4, S("abcdefghij2345")); test(S("abcdefghijklmnopqrst"), 10, 10, S("12345"), 1, 5, S("abcdefghij2345")); test(S("abcdefghijklmnopqrst"), 10, 10, S("12345"), 2, 0, S("abcdefghij")); + + return true; } template -void test49() +TEST_CONSTEXPR_CXX20 bool test49() { test(S("abcdefghijklmnopqrst"), 10, 10, S("12345"), 2, 1, S("abcdefghij3")); test(S("abcdefghijklmnopqrst"), 10, 10, S("12345"), 2, 2, S("abcdefghij34")); @@ -5338,10 +5436,12 @@ test(S("abcdefghijklmnopqrst"), 10, 11, S("1234567890"), 5, 1, S("abcdefghij6")); test(S("abcdefghijklmnopqrst"), 10, 11, S("1234567890"), 5, 2, S("abcdefghij67")); test(S("abcdefghijklmnopqrst"), 10, 11, S("1234567890"), 5, 4, S("abcdefghij6789")); + + return true; } template -void test50() +TEST_CONSTEXPR_CXX20 bool test50() { test(S("abcdefghijklmnopqrst"), 10, 11, S("1234567890"), 5, 5, S("abcdefghij67890")); test(S("abcdefghijklmnopqrst"), 10, 11, S("1234567890"), 5, 6, S("abcdefghij67890")); @@ -5443,10 +5543,12 @@ test(S("abcdefghijklmnopqrst"), 19, 0, S("12345678901234567890"), 10, 9, S("abcdefghijklmnopqrs123456789t")); test(S("abcdefghijklmnopqrst"), 19, 0, S("12345678901234567890"), 10, 10, S("abcdefghijklmnopqrs1234567890t")); test(S("abcdefghijklmnopqrst"), 19, 0, S("12345678901234567890"), 10, 11, S("abcdefghijklmnopqrs1234567890t")); + + return true; } template -void test51() +TEST_CONSTEXPR_CXX20 bool test51() { test(S("abcdefghijklmnopqrst"), 19, 0, S("12345678901234567890"), 19, 0, S("abcdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 19, 0, S("12345678901234567890"), 19, 1, S("abcdefghijklmnopqrs0t")); @@ -5548,10 +5650,12 @@ test(S("abcdefghijklmnopqrst"), 19, 2, S("12345"), 2, 2, S("abcdefghijklmnopqrs34")); test(S("abcdefghijklmnopqrst"), 19, 2, S("12345"), 2, 3, S("abcdefghijklmnopqrs345")); test(S("abcdefghijklmnopqrst"), 19, 2, S("12345"), 2, 4, S("abcdefghijklmnopqrs345")); + + return true; } template -void test52() +TEST_CONSTEXPR_CXX20 bool test52() { test(S("abcdefghijklmnopqrst"), 19, 2, S("12345"), 4, 0, S("abcdefghijklmnopqrs")); test(S("abcdefghijklmnopqrst"), 19, 2, S("12345"), 4, 1, S("abcdefghijklmnopqrs5")); @@ -5653,10 +5757,12 @@ test(S("abcdefghijklmnopqrst"), 20, 0, S("1234567890"), 5, 6, S("abcdefghijklmnopqrst67890")); test(S("abcdefghijklmnopqrst"), 20, 0, S("1234567890"), 9, 0, S("abcdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 20, 0, S("1234567890"), 9, 1, S("abcdefghijklmnopqrst0")); + + return true; } template -void test53() +TEST_CONSTEXPR_CXX20 bool test53() { test(S("abcdefghijklmnopqrst"), 20, 0, S("1234567890"), 9, 2, S("abcdefghijklmnopqrst0")); test(S("abcdefghijklmnopqrst"), 20, 0, S("1234567890"), 10, 0, S("abcdefghijklmnopqrst")); @@ -5758,10 +5864,12 @@ test(S("abcdefghijklmnopqrst"), 20, 1, S("12345678901234567890"), 19, 1, S("abcdefghijklmnopqrst0")); test(S("abcdefghijklmnopqrst"), 20, 1, S("12345678901234567890"), 19, 2, S("abcdefghijklmnopqrst0")); test(S("abcdefghijklmnopqrst"), 20, 1, S("12345678901234567890"), 20, 0, S("abcdefghijklmnopqrst")); + + return true; } template -void test54() +TEST_CONSTEXPR_CXX20 bool test54() { test(S("abcdefghijklmnopqrst"), 20, 1, S("12345678901234567890"), 20, 1, S("abcdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 20, 1, S("12345678901234567890"), 21, 0, S("can't happen")); @@ -5839,10 +5947,12 @@ test(S("abcdefghijklmnopqrst"), 21, 0, S("12345678901234567890"), 20, 0, S("can't happen")); test(S("abcdefghijklmnopqrst"), 21, 0, S("12345678901234567890"), 20, 1, S("can't happen")); test(S("abcdefghijklmnopqrst"), 21, 0, S("12345678901234567890"), 21, 0, S("can't happen")); + + return true; } template -void test55() +TEST_CONSTEXPR_CXX20 bool test55() { test_npos(S("abcdefghij"), 9, 1, S("12345678901234567890"), 10, S("abcdefghi1234567890")); test_npos(S("abcdefghij"), 9, 1, S("12345678901234567890"), 19, S("abcdefghi0")); @@ -5857,129 +5967,134 @@ test_npos(S("abcdefghij"), 9, 2, S("12345"), 4, S("abcdefghi5")); test_npos(S("abcdefghij"), 9, 2, S("12345"), 5, S("abcdefghi")); test_npos(S("abcdefghij"), 9, 2, S("12345"), 6, S("can't happen")); + + return true; +} + +template +void test() { + test0(); + test1(); + test2(); + test3(); + test4(); + test5(); + test6(); + test7(); + test8(); + test9(); + test10(); + test11(); + test12(); + test13(); + test14(); + test15(); + test16(); + test17(); + test18(); + test19(); + test20(); + test21(); + test22(); + test23(); + test24(); + test25(); + test26(); + test27(); + test28(); + test29(); + test30(); + test31(); + test32(); + test33(); + test34(); + test35(); + test36(); + test37(); + test38(); + test39(); + test40(); + test41(); + test42(); + test43(); + test44(); + test45(); + test46(); + test47(); + test48(); + test49(); + test50(); + test51(); + test52(); + test53(); + test54(); + test55(); + +#if TEST_STD_VER > 17 + // static_assert(test0()); + // static_assert(test1()); + // static_assert(test2()); + // static_assert(test3()); + // static_assert(test4()); + // static_assert(test5()); + // static_assert(test6()); + // static_assert(test7()); + // static_assert(test8()); + // static_assert(test9()); + // static_assert(test10()); + // static_assert(test11()); + // static_assert(test12()); + // static_assert(test13()); + // static_assert(test14()); + // static_assert(test15()); + // static_assert(test16()); + // static_assert(test17()); + // static_assert(test18()); + // static_assert(test19()); + // static_assert(test20()); + // static_assert(test21()); + // static_assert(test22()); + // static_assert(test23()); + // static_assert(test24()); + // static_assert(test25()); + // static_assert(test26()); + // static_assert(test27()); + // static_assert(test28()); + // static_assert(test29()); + // static_assert(test30()); + // static_assert(test31()); + // static_assert(test32()); + // static_assert(test33()); + // static_assert(test34()); + // static_assert(test35()); + // static_assert(test36()); + // static_assert(test37()); + // static_assert(test38()); + // static_assert(test39()); + // static_assert(test40()); + // static_assert(test41()); + // static_assert(test42()); + // static_assert(test43()); + // static_assert(test44()); + // static_assert(test45()); + // static_assert(test46()); + // static_assert(test47()); + // static_assert(test48()); + // static_assert(test49()); + // static_assert(test50()); + // static_assert(test51()); + // static_assert(test52()); + // static_assert(test53()); + // static_assert(test54()); + // static_assert(test55()); +#endif } int main(int, char**) { - { - typedef std::string S; - test0(); - test1(); - test2(); - test3(); - test4(); - test5(); - test6(); - test7(); - test8(); - test9(); - test10(); - test11(); - test12(); - test13(); - test14(); - test15(); - test16(); - test17(); - test18(); - test19(); - test20(); - test21(); - test22(); - test23(); - test24(); - test25(); - test26(); - test27(); - test28(); - test29(); - test30(); - test31(); - test32(); - test33(); - test34(); - test35(); - test36(); - test37(); - test38(); - test39(); - test40(); - test41(); - test42(); - test43(); - test44(); - test45(); - test46(); - test47(); - test48(); - test49(); - test50(); - test51(); - test52(); - test53(); - test54(); - test55(); - } + test(); #if TEST_STD_VER >= 11 - { - typedef std::basic_string, min_allocator> S; - test0(); - test1(); - test2(); - test3(); - test4(); - test5(); - test6(); - test7(); - test8(); - test9(); - test10(); - test11(); - test12(); - test13(); - test14(); - test15(); - test16(); - test17(); - test18(); - test19(); - test20(); - test21(); - test22(); - test23(); - test24(); - test25(); - test26(); - test27(); - test28(); - test29(); - test30(); - test31(); - test32(); - test33(); - test34(); - test35(); - test36(); - test37(); - test38(); - test39(); - test40(); - test41(); - test42(); - test43(); - test44(); - test45(); - test46(); - test47(); - test48(); - test49(); - test50(); - test51(); - test52(); - test53(); - test54(); - test55(); - } + test, min_allocator>>(); #endif return 0; diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_view.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_view.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_view.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_view.pass.cpp @@ -20,7 +20,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(S s, typename S::size_type pos1, typename S::size_type n1, SV sv, S expected) { const typename S::size_type old_size = s.size(); @@ -52,7 +52,7 @@ } template -void test0() +TEST_CONSTEXPR_CXX20 void test0() { test(S(""), 0, 0, SV(""), S("")); test(S(""), 0, 0, SV("12345"), S("12345")); @@ -157,7 +157,7 @@ } template -void test1() +TEST_CONSTEXPR_CXX20 void test1() { test(S("abcde"), 6, 0, SV(""), S("can't happen")); test(S("abcde"), 6, 0, SV("12345"), S("can't happen")); @@ -262,7 +262,7 @@ } template -void test2() +TEST_CONSTEXPR_CXX20 void test2() { test(S("abcdefghijklmnopqrst"), 0, 0, SV(""), S("abcdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345"), S("12345abcdefghijklmnopqrst")); @@ -362,23 +362,32 @@ test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345678901234567890"), S("can't happen")); } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; typedef std::string_view SV; test0(); test1(); test2(); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; typedef std::string_view SV; test0(); test1(); test2(); - } + } +#endif + + return true; +} + +int main(int, char**) +{ + test(); +#if TEST_STD_VER > 17 + // static_assert(test()); #endif return 0; diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_swap/swap.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_swap/swap.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.modifiers/string_swap/swap.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_swap/swap.pass.cpp @@ -19,7 +19,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(S s1, S s2) { S s1_ = s1; @@ -31,9 +31,8 @@ assert(s2 == s1_); } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; test(S(""), S("")); test(S(""), S("12345")); @@ -51,9 +50,9 @@ test(S("abcdefghijklmnopqrst"), S("12345")); test(S("abcdefghijklmnopqrst"), S("1234567890")); test(S("abcdefghijklmnopqrst"), S("12345678901234567890")); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; test(S(""), S("")); test(S(""), S("12345")); @@ -71,7 +70,17 @@ test(S("abcdefghijklmnopqrst"), S("12345")); test(S("abcdefghijklmnopqrst"), S("1234567890")); test(S("abcdefghijklmnopqrst"), S("12345678901234567890")); - } + } +#endif + + return true; +} + +int main(int, char**) +{ + test(); +#if TEST_STD_VER > 17 + // static_assert(test()); #endif return 0;