diff --git a/libcxx/test/std/strings/basic.string/string.ops/string.accessors/c_str.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string.accessors/c_str.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.ops/string.accessors/c_str.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.ops/string.accessors/c_str.pass.cpp @@ -17,7 +17,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(const S& s) { typedef typename S::traits_type T; @@ -31,23 +31,32 @@ assert(T::eq(str[0], typename S::value_type())); } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; test(S("")); test(S("abcde")); test(S("abcdefghij")); test(S("abcdefghijklmnopqrst")); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; test(S("")); test(S("abcde")); test(S("abcdefghij")); test(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.ops/string.accessors/data.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string.accessors/data.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.ops/string.accessors/data.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.ops/string.accessors/data.pass.cpp @@ -18,7 +18,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test_const(const S& s) { typedef typename S::traits_type T; @@ -33,7 +33,7 @@ } template -void +TEST_CONSTEXPR_CXX20 void test_nonconst(S& s) { typedef typename S::traits_type T; @@ -47,32 +47,41 @@ assert(T::eq(str[0], typename S::value_type())); } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; test_const(S("")); test_const(S("abcde")); test_const(S("abcdefghij")); test_const(S("abcdefghijklmnopqrst")); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; test_const(S("")); test_const(S("abcde")); test_const(S("abcdefghij")); test_const(S("abcdefghijklmnopqrst")); - } + } #endif #if TEST_STD_VER > 14 - { + { typedef std::string S; S s1(""); test_nonconst(s1); S s2("abcde"); test_nonconst(s2); S s3("abcdefghij"); test_nonconst(s3); S s4("abcdefghijklmnopqrst"); test_nonconst(s4); - } + } +#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.ops/string.accessors/get_allocator.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string.accessors/get_allocator.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.ops/string.accessors/get_allocator.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.ops/string.accessors/get_allocator.pass.cpp @@ -18,31 +18,40 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(const S& s, const typename S::allocator_type& a) { assert(s.get_allocator() == a); } -int main(int, char**) -{ - { +bool test() { + { typedef test_allocator A; typedef std::basic_string, A> S; test(S(""), A()); test(S("abcde", A(1)), A(1)); test(S("abcdefghij", A(2)), A(2)); test(S("abcdefghijklmnopqrst", A(3)), A(3)); - } + } #if TEST_STD_VER >= 11 - { + { typedef min_allocator A; typedef std::basic_string, A> S; test(S(""), A()); test(S("abcde", A()), A()); test(S("abcdefghij", A()), A()); test(S("abcdefghijklmnopqrst", A()), 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.ops/string_compare/pointer.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_compare/pointer.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.ops/string_compare/pointer.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.ops/string_compare/pointer.pass.cpp @@ -16,7 +16,7 @@ #include "test_macros.h" #include "min_allocator.h" -int sign(int x) +TEST_CONSTEXPR_CXX20 int sign(int x) { if (x == 0) return 0; @@ -26,16 +26,15 @@ } template -void +TEST_CONSTEXPR_CXX20 void test(const S& s, const typename S::value_type* str, int x) { LIBCPP_ASSERT_NOEXCEPT(s.compare(str)); assert(sign(s.compare(str)) == sign(x)); } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; test(S(""), "", 0); test(S(""), "abcde", -5); @@ -53,9 +52,9 @@ test(S("abcdefghijklmnopqrst"), "abcde", 15); test(S("abcdefghijklmnopqrst"), "abcdefghij", 10); test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", 0); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; test(S(""), "", 0); test(S(""), "abcde", -5); @@ -73,7 +72,17 @@ test(S("abcdefghijklmnopqrst"), "abcde", 15); test(S("abcdefghijklmnopqrst"), "abcdefghij", 10); test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", 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.ops/string_compare/size_size_T_size_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_T_size_size.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_T_size_size.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_T_size_size.pass.cpp @@ -80,7 +80,7 @@ } template -void test0() +TEST_CONSTEXPR_CXX20 bool test0() { test(S(""), 0, 0, SV(""), 0, 0, 0); test(S(""), 0, 0, SV(""), 0, 1, 0); @@ -182,10 +182,12 @@ test(S(""), 0, 1, SV("abcde"), 5, 0, 0); test(S(""), 0, 1, SV("abcde"), 5, 1, 0); test(S(""), 0, 1, SV("abcde"), 6, 0, 0); + + return true; } template -void test1() +TEST_CONSTEXPR_CXX20 bool test1() { test(S(""), 0, 1, SV("abcdefghij"), 0, 0, 0); test(S(""), 0, 1, SV("abcdefghij"), 0, 1, -1); @@ -287,10 +289,12 @@ test(S(""), 1, 0, SV("abcdefghij"), 11, 0, 0); test(S(""), 1, 0, SV("abcdefghijklmnopqrst"), 0, 0, 0); test(S(""), 1, 0, SV("abcdefghijklmnopqrst"), 0, 1, 0); + + return true; } template -void test2() +TEST_CONSTEXPR_CXX20 bool test2() { test(S(""), 1, 0, SV("abcdefghijklmnopqrst"), 0, 10, 0); test(S(""), 1, 0, SV("abcdefghijklmnopqrst"), 0, 19, 0); @@ -392,10 +396,12 @@ test(S("abcde"), 0, 1, SV(""), 0, 1, 1); test(S("abcde"), 0, 1, SV(""), 1, 0, 0); test(S("abcde"), 0, 1, SV("abcde"), 0, 0, 1); + + return true; } template -void test3() +TEST_CONSTEXPR_CXX20 bool test3() { test(S("abcde"), 0, 1, SV("abcde"), 0, 1, 0); test(S("abcde"), 0, 1, SV("abcde"), 0, 2, -1); @@ -497,10 +503,12 @@ test(S("abcde"), 0, 2, SV("abcdefghij"), 0, 1, 1); test(S("abcde"), 0, 2, SV("abcdefghij"), 0, 5, -3); test(S("abcde"), 0, 2, SV("abcdefghij"), 0, 9, -7); + + return true; } template -void test4() +TEST_CONSTEXPR_CXX20 bool test4() { test(S("abcde"), 0, 2, SV("abcdefghij"), 0, 10, -8); test(S("abcde"), 0, 2, SV("abcdefghij"), 0, 11, -8); @@ -602,10 +610,12 @@ test(S("abcde"), 0, 4, SV("abcdefghijklmnopqrst"), 0, 19, -15); test(S("abcde"), 0, 4, SV("abcdefghijklmnopqrst"), 0, 20, -16); test(S("abcde"), 0, 4, SV("abcdefghijklmnopqrst"), 0, 21, -16); + + return true; } template -void test5() +TEST_CONSTEXPR_CXX20 bool test5() { test(S("abcde"), 0, 4, SV("abcdefghijklmnopqrst"), 1, 0, 4); test(S("abcde"), 0, 4, SV("abcdefghijklmnopqrst"), 1, 1, -1); @@ -707,10 +717,12 @@ test(S("abcde"), 0, 6, SV("abcde"), 0, 2, 3); test(S("abcde"), 0, 6, SV("abcde"), 0, 4, 1); test(S("abcde"), 0, 6, SV("abcde"), 0, 5, 0); + + return true; } template -void test6() +TEST_CONSTEXPR_CXX20 bool test6() { test(S("abcde"), 0, 6, SV("abcde"), 0, 6, 0); test(S("abcde"), 0, 6, SV("abcde"), 1, 0, 5); @@ -812,10 +824,12 @@ test(S("abcde"), 1, 0, SV("abcdefghij"), 0, 11, -10); test(S("abcde"), 1, 0, SV("abcdefghij"), 1, 0, 0); test(S("abcde"), 1, 0, SV("abcdefghij"), 1, 1, -1); + + return true; } template -void test7() +TEST_CONSTEXPR_CXX20 bool test7() { test(S("abcde"), 1, 0, SV("abcdefghij"), 1, 4, -4); test(S("abcde"), 1, 0, SV("abcdefghij"), 1, 8, -8); @@ -917,10 +931,12 @@ test(S("abcde"), 1, 1, SV("abcdefghijklmnopqrst"), 1, 1, 0); test(S("abcde"), 1, 1, SV("abcdefghijklmnopqrst"), 1, 9, -8); test(S("abcde"), 1, 1, SV("abcdefghijklmnopqrst"), 1, 18, -17); + + return true; } template -void test8() +TEST_CONSTEXPR_CXX20 bool test8() { test(S("abcde"), 1, 1, SV("abcdefghijklmnopqrst"), 1, 19, -18); test(S("abcde"), 1, 1, SV("abcdefghijklmnopqrst"), 1, 20, -18); @@ -1022,10 +1038,12 @@ test(S("abcde"), 1, 3, SV("abcde"), 1, 0, 3); test(S("abcde"), 1, 3, SV("abcde"), 1, 1, 2); test(S("abcde"), 1, 3, SV("abcde"), 1, 2, 1); + + return true; } template -void test9() +TEST_CONSTEXPR_CXX20 bool test9() { test(S("abcde"), 1, 3, SV("abcde"), 1, 3, 0); test(S("abcde"), 1, 3, SV("abcde"), 1, 4, -1); @@ -1127,10 +1145,12 @@ test(S("abcde"), 1, 4, SV("abcdefghij"), 1, 8, -4); test(S("abcde"), 1, 4, SV("abcdefghij"), 1, 9, -5); test(S("abcde"), 1, 4, SV("abcdefghij"), 1, 10, -5); + + return true; } template -void test10() +TEST_CONSTEXPR_CXX20 bool test10() { test(S("abcde"), 1, 4, SV("abcdefghij"), 5, 0, 4); test(S("abcde"), 1, 4, SV("abcdefghij"), 5, 1, -4); @@ -1232,10 +1252,12 @@ test(S("abcde"), 1, 5, SV("abcdefghijklmnopqrst"), 1, 20, -15); test(S("abcde"), 1, 5, SV("abcdefghijklmnopqrst"), 10, 0, 4); test(S("abcde"), 1, 5, SV("abcdefghijklmnopqrst"), 10, 1, -9); + + return true; } template -void test11() +TEST_CONSTEXPR_CXX20 bool test11() { test(S("abcde"), 1, 5, SV("abcdefghijklmnopqrst"), 10, 5, -9); test(S("abcde"), 1, 5, SV("abcdefghijklmnopqrst"), 10, 9, -9); @@ -1337,10 +1359,12 @@ test(S("abcde"), 2, 1, SV("abcde"), 1, 4, 1); test(S("abcde"), 2, 1, SV("abcde"), 1, 5, 1); test(S("abcde"), 2, 1, SV("abcde"), 2, 0, 1); + + return true; } template -void test12() +TEST_CONSTEXPR_CXX20 bool test12() { test(S("abcde"), 2, 1, SV("abcde"), 2, 1, 0); test(S("abcde"), 2, 1, SV("abcde"), 2, 2, -1); @@ -1442,10 +1466,12 @@ test(S("abcde"), 2, 2, SV("abcdefghij"), 5, 1, -3); test(S("abcde"), 2, 2, SV("abcdefghij"), 5, 2, -3); test(S("abcde"), 2, 2, SV("abcdefghij"), 5, 4, -3); + + return true; } template -void test13() +TEST_CONSTEXPR_CXX20 bool test13() { test(S("abcde"), 2, 2, SV("abcdefghij"), 5, 5, -3); test(S("abcde"), 2, 2, SV("abcdefghij"), 5, 6, -3); @@ -1547,10 +1573,12 @@ test(S("abcde"), 2, 3, SV("abcdefghijklmnopqrst"), 10, 9, -8); test(S("abcde"), 2, 3, SV("abcdefghijklmnopqrst"), 10, 10, -8); test(S("abcde"), 2, 3, SV("abcdefghijklmnopqrst"), 10, 11, -8); + + return true; } template -void test14() +TEST_CONSTEXPR_CXX20 bool test14() { test(S("abcde"), 2, 3, SV("abcdefghijklmnopqrst"), 19, 0, 3); test(S("abcde"), 2, 3, SV("abcdefghijklmnopqrst"), 19, 1, -17); @@ -1652,10 +1680,12 @@ test(S("abcde"), 4, 0, SV("abcde"), 2, 2, -2); test(S("abcde"), 4, 0, SV("abcde"), 2, 3, -3); test(S("abcde"), 4, 0, SV("abcde"), 2, 4, -3); + + return true; } template -void test15() +TEST_CONSTEXPR_CXX20 bool test15() { test(S("abcde"), 4, 0, SV("abcde"), 4, 0, 0); test(S("abcde"), 4, 0, SV("abcde"), 4, 1, -1); @@ -1757,10 +1787,12 @@ test(S("abcde"), 4, 1, SV("abcdefghij"), 5, 6, -1); test(S("abcde"), 4, 1, SV("abcdefghij"), 9, 0, 1); test(S("abcde"), 4, 1, SV("abcdefghij"), 9, 1, -5); + + return true; } template -void test16() +TEST_CONSTEXPR_CXX20 bool test16() { test(S("abcde"), 4, 1, SV("abcdefghij"), 9, 2, -5); test(S("abcde"), 4, 1, SV("abcdefghij"), 10, 0, 1); @@ -1862,10 +1894,12 @@ test(S("abcde"), 4, 2, SV("abcdefghijklmnopqrst"), 19, 1, -15); test(S("abcde"), 4, 2, SV("abcdefghijklmnopqrst"), 19, 2, -15); test(S("abcde"), 4, 2, SV("abcdefghijklmnopqrst"), 20, 0, 1); + + return true; } template -void test17() +TEST_CONSTEXPR_CXX20 bool test17() { test(S("abcde"), 4, 2, SV("abcdefghijklmnopqrst"), 20, 1, 1); test(S("abcde"), 4, 2, SV("abcdefghijklmnopqrst"), 21, 0, 0); @@ -1967,10 +2001,12 @@ test(S("abcde"), 5, 1, SV("abcde"), 4, 1, -1); test(S("abcde"), 5, 1, SV("abcde"), 4, 2, -1); test(S("abcde"), 5, 1, SV("abcde"), 5, 0, 0); + + return true; } template -void test18() +TEST_CONSTEXPR_CXX20 bool test18() { test(S("abcde"), 5, 1, SV("abcde"), 5, 1, 0); test(S("abcde"), 5, 1, SV("abcde"), 6, 0, 0); @@ -2072,10 +2108,12 @@ test(S("abcde"), 6, 0, SV("abcdefghij"), 10, 0, 0); test(S("abcde"), 6, 0, SV("abcdefghij"), 10, 1, 0); test(S("abcde"), 6, 0, SV("abcdefghij"), 11, 0, 0); + + return true; } template -void test19() +TEST_CONSTEXPR_CXX20 bool test19() { test(S("abcde"), 6, 0, SV("abcdefghijklmnopqrst"), 0, 0, 0); test(S("abcde"), 6, 0, SV("abcdefghijklmnopqrst"), 0, 1, 0); @@ -2177,10 +2215,12 @@ test(S("abcdefghij"), 0, 0, SV("abcdefghijklmnopqrst"), 21, 0, 0); test(S("abcdefghij"), 0, 1, SV(""), 0, 0, 1); test(S("abcdefghij"), 0, 1, SV(""), 0, 1, 1); + + return true; } template -void test20() +TEST_CONSTEXPR_CXX20 bool test20() { test(S("abcdefghij"), 0, 1, SV(""), 1, 0, 0); test(S("abcdefghij"), 0, 1, SV("abcde"), 0, 0, 1); @@ -2282,10 +2322,12 @@ test(S("abcdefghij"), 0, 5, SV("abcde"), 6, 0, 0); test(S("abcdefghij"), 0, 5, SV("abcdefghij"), 0, 0, 5); test(S("abcdefghij"), 0, 5, SV("abcdefghij"), 0, 1, 4); + + return true; } template -void test21() +TEST_CONSTEXPR_CXX20 bool test21() { test(S("abcdefghij"), 0, 5, SV("abcdefghij"), 0, 5, 0); test(S("abcdefghij"), 0, 5, SV("abcdefghij"), 0, 9, -4); @@ -2387,10 +2429,12 @@ test(S("abcdefghij"), 0, 9, SV("abcdefghijklmnopqrst"), 0, 1, 8); test(S("abcdefghij"), 0, 9, SV("abcdefghijklmnopqrst"), 0, 10, -1); test(S("abcdefghij"), 0, 9, SV("abcdefghijklmnopqrst"), 0, 19, -10); + + return true; } template -void test22() +TEST_CONSTEXPR_CXX20 bool test22() { test(S("abcdefghij"), 0, 9, SV("abcdefghijklmnopqrst"), 0, 20, -11); test(S("abcdefghij"), 0, 9, SV("abcdefghijklmnopqrst"), 0, 21, -11); @@ -2492,10 +2536,12 @@ test(S("abcdefghij"), 0, 11, SV("abcde"), 0, 0, 10); test(S("abcdefghij"), 0, 11, SV("abcde"), 0, 1, 9); test(S("abcdefghij"), 0, 11, SV("abcde"), 0, 2, 8); + + return true; } template -void test23() +TEST_CONSTEXPR_CXX20 bool test23() { test(S("abcdefghij"), 0, 11, SV("abcde"), 0, 4, 6); test(S("abcdefghij"), 0, 11, SV("abcde"), 0, 5, 5); @@ -2597,10 +2643,12 @@ test(S("abcdefghij"), 1, 0, SV("abcdefghij"), 0, 9, -9); test(S("abcdefghij"), 1, 0, SV("abcdefghij"), 0, 10, -10); test(S("abcdefghij"), 1, 0, SV("abcdefghij"), 0, 11, -10); + + return true; } template -void test24() +TEST_CONSTEXPR_CXX20 bool test24() { test(S("abcdefghij"), 1, 0, SV("abcdefghij"), 1, 0, 0); test(S("abcdefghij"), 1, 0, SV("abcdefghij"), 1, 1, -1); @@ -2702,10 +2750,12 @@ test(S("abcdefghij"), 1, 1, SV("abcdefghijklmnopqrst"), 0, 21, 1); test(S("abcdefghij"), 1, 1, SV("abcdefghijklmnopqrst"), 1, 0, 1); test(S("abcdefghij"), 1, 1, SV("abcdefghijklmnopqrst"), 1, 1, 0); + + return true; } template -void test25() +TEST_CONSTEXPR_CXX20 bool test25() { test(S("abcdefghij"), 1, 1, SV("abcdefghijklmnopqrst"), 1, 9, -8); test(S("abcdefghij"), 1, 1, SV("abcdefghijklmnopqrst"), 1, 18, -17); @@ -2807,10 +2857,12 @@ test(S("abcdefghij"), 1, 8, SV("abcde"), 0, 5, 1); test(S("abcdefghij"), 1, 8, SV("abcde"), 0, 6, 1); test(S("abcdefghij"), 1, 8, SV("abcde"), 1, 0, 8); + + return true; } template -void test26() +TEST_CONSTEXPR_CXX20 bool test26() { test(S("abcdefghij"), 1, 8, SV("abcde"), 1, 1, 7); test(S("abcdefghij"), 1, 8, SV("abcde"), 1, 2, 6); @@ -2912,10 +2964,12 @@ test(S("abcdefghij"), 1, 9, SV("abcdefghij"), 1, 1, 8); test(S("abcdefghij"), 1, 9, SV("abcdefghij"), 1, 4, 5); test(S("abcdefghij"), 1, 9, SV("abcdefghij"), 1, 8, 1); + + return true; } template -void test27() +TEST_CONSTEXPR_CXX20 bool test27() { test(S("abcdefghij"), 1, 9, SV("abcdefghij"), 1, 9, 0); test(S("abcdefghij"), 1, 9, SV("abcdefghij"), 1, 10, 0); @@ -3017,10 +3071,12 @@ test(S("abcdefghij"), 1, 10, SV("abcdefghijklmnopqrst"), 1, 18, -9); test(S("abcdefghij"), 1, 10, SV("abcdefghijklmnopqrst"), 1, 19, -10); test(S("abcdefghij"), 1, 10, SV("abcdefghijklmnopqrst"), 1, 20, -10); + + return true; } template -void test28() +TEST_CONSTEXPR_CXX20 bool test28() { test(S("abcdefghij"), 1, 10, SV("abcdefghijklmnopqrst"), 10, 0, 9); test(S("abcdefghij"), 1, 10, SV("abcdefghijklmnopqrst"), 10, 1, -9); @@ -3122,10 +3178,12 @@ test(S("abcdefghij"), 5, 1, SV("abcde"), 1, 2, 4); test(S("abcdefghij"), 5, 1, SV("abcde"), 1, 3, 4); test(S("abcdefghij"), 5, 1, SV("abcde"), 1, 4, 4); + + return true; } template -void test29() +TEST_CONSTEXPR_CXX20 bool test29() { test(S("abcdefghij"), 5, 1, SV("abcde"), 1, 5, 4); test(S("abcdefghij"), 5, 1, SV("abcde"), 2, 0, 1); @@ -3227,10 +3285,12 @@ test(S("abcdefghij"), 5, 2, SV("abcdefghij"), 1, 10, 4); test(S("abcdefghij"), 5, 2, SV("abcdefghij"), 5, 0, 2); test(S("abcdefghij"), 5, 2, SV("abcdefghij"), 5, 1, 1); + + return true; } template -void test30() +TEST_CONSTEXPR_CXX20 bool test30() { test(S("abcdefghij"), 5, 2, SV("abcdefghij"), 5, 2, 0); test(S("abcdefghij"), 5, 2, SV("abcdefghij"), 5, 4, -2); @@ -3332,10 +3392,12 @@ test(S("abcdefghij"), 5, 4, SV("abcdefghijklmnopqrst"), 10, 1, -5); test(S("abcdefghij"), 5, 4, SV("abcdefghijklmnopqrst"), 10, 5, -5); test(S("abcdefghij"), 5, 4, SV("abcdefghijklmnopqrst"), 10, 9, -5); + + return true; } template -void test31() +TEST_CONSTEXPR_CXX20 bool test31() { test(S("abcdefghij"), 5, 4, SV("abcdefghijklmnopqrst"), 10, 10, -5); test(S("abcdefghij"), 5, 4, SV("abcdefghijklmnopqrst"), 10, 11, -5); @@ -3437,10 +3499,12 @@ test(S("abcdefghij"), 5, 6, SV("abcde"), 2, 0, 5); test(S("abcdefghij"), 5, 6, SV("abcde"), 2, 1, 3); test(S("abcdefghij"), 5, 6, SV("abcde"), 2, 2, 3); + + return true; } template -void test32() +TEST_CONSTEXPR_CXX20 bool test32() { test(S("abcdefghij"), 5, 6, SV("abcde"), 2, 3, 3); test(S("abcdefghij"), 5, 6, SV("abcde"), 2, 4, 3); @@ -3542,10 +3606,12 @@ test(S("abcdefghij"), 9, 0, SV("abcdefghij"), 5, 4, -4); test(S("abcdefghij"), 9, 0, SV("abcdefghij"), 5, 5, -5); test(S("abcdefghij"), 9, 0, SV("abcdefghij"), 5, 6, -5); + + return true; } template -void test33() +TEST_CONSTEXPR_CXX20 bool test33() { test(S("abcdefghij"), 9, 0, SV("abcdefghij"), 9, 0, 0); test(S("abcdefghij"), 9, 0, SV("abcdefghij"), 9, 1, -1); @@ -3647,10 +3713,12 @@ test(S("abcdefghij"), 9, 1, SV("abcdefghijklmnopqrst"), 10, 11, -1); test(S("abcdefghij"), 9, 1, SV("abcdefghijklmnopqrst"), 19, 0, 1); test(S("abcdefghij"), 9, 1, SV("abcdefghijklmnopqrst"), 19, 1, -10); + + return true; } template -void test34() +TEST_CONSTEXPR_CXX20 bool test34() { test(S("abcdefghij"), 9, 1, SV("abcdefghijklmnopqrst"), 19, 2, -10); test(S("abcdefghij"), 9, 1, SV("abcdefghijklmnopqrst"), 20, 0, 1); @@ -3752,10 +3820,12 @@ test(S("abcdefghij"), 10, 0, SV("abcde"), 2, 4, -3); test(S("abcdefghij"), 10, 0, SV("abcde"), 4, 0, 0); test(S("abcdefghij"), 10, 0, SV("abcde"), 4, 1, -1); + + return true; } template -void test35() +TEST_CONSTEXPR_CXX20 bool test35() { test(S("abcdefghij"), 10, 0, SV("abcde"), 4, 2, -1); test(S("abcdefghij"), 10, 0, SV("abcde"), 5, 0, 0); @@ -3857,10 +3927,12 @@ test(S("abcdefghij"), 10, 1, SV("abcdefghij"), 9, 1, -1); test(S("abcdefghij"), 10, 1, SV("abcdefghij"), 9, 2, -1); test(S("abcdefghij"), 10, 1, SV("abcdefghij"), 10, 0, 0); + + return true; } template -void test36() +TEST_CONSTEXPR_CXX20 bool test36() { test(S("abcdefghij"), 10, 1, SV("abcdefghij"), 10, 1, 0); test(S("abcdefghij"), 10, 1, SV("abcdefghij"), 11, 0, 0); @@ -3962,10 +4034,12 @@ test(S("abcdefghij"), 11, 0, SV("abcdefghijklmnopqrst"), 20, 0, 0); test(S("abcdefghij"), 11, 0, SV("abcdefghijklmnopqrst"), 20, 1, 0); test(S("abcdefghij"), 11, 0, SV("abcdefghijklmnopqrst"), 21, 0, 0); + + return true; } template -void test37() +TEST_CONSTEXPR_CXX20 bool test37() { test(S("abcdefghijklmnopqrst"), 0, 0, SV(""), 0, 0, 0); test(S("abcdefghijklmnopqrst"), 0, 0, SV(""), 0, 1, 0); @@ -4067,10 +4141,12 @@ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcde"), 5, 0, 1); test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcde"), 5, 1, 1); test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcde"), 6, 0, 0); + + return true; } template -void test38() +TEST_CONSTEXPR_CXX20 bool test38() { test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcdefghij"), 0, 0, 1); test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcdefghij"), 0, 1, 0); @@ -4172,10 +4248,12 @@ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcdefghij"), 11, 0, 0); test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcdefghijklmnopqrst"), 0, 0, 10); test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcdefghijklmnopqrst"), 0, 1, 9); + + return true; } template -void test39() +TEST_CONSTEXPR_CXX20 bool test39() { test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcdefghijklmnopqrst"), 0, 10, 0); test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcdefghijklmnopqrst"), 0, 19, -9); @@ -4277,10 +4355,12 @@ test(S("abcdefghijklmnopqrst"), 0, 20, SV(""), 0, 1, 20); test(S("abcdefghijklmnopqrst"), 0, 20, SV(""), 1, 0, 0); test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcde"), 0, 0, 20); + + return true; } template -void test40() +TEST_CONSTEXPR_CXX20 bool test40() { test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcde"), 0, 1, 19); test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcde"), 0, 2, 18); @@ -4382,10 +4462,12 @@ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcdefghij"), 0, 1, 19); test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcdefghij"), 0, 5, 15); test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcdefghij"), 0, 9, 11); + + return true; } template -void test41() +TEST_CONSTEXPR_CXX20 bool test41() { test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcdefghij"), 0, 10, 10); test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcdefghij"), 0, 11, 10); @@ -4487,10 +4569,12 @@ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcdefghijklmnopqrst"), 0, 19, -19); test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcdefghijklmnopqrst"), 0, 20, -20); test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcdefghijklmnopqrst"), 0, 21, -20); + + return true; } template -void test42() +TEST_CONSTEXPR_CXX20 bool test42() { test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcdefghijklmnopqrst"), 1, 0, 0); test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcdefghijklmnopqrst"), 1, 1, -1); @@ -4592,10 +4676,12 @@ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcde"), 0, 2, 1); test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcde"), 0, 4, 1); test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcde"), 0, 5, 1); + + return true; } template -void test43() +TEST_CONSTEXPR_CXX20 bool test43() { test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcde"), 0, 6, 1); test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcde"), 1, 0, 9); @@ -4697,10 +4783,12 @@ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcdefghij"), 0, 11, 1); test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcdefghij"), 1, 0, 18); test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcdefghij"), 1, 1, 17); + + return true; } template -void test44() +TEST_CONSTEXPR_CXX20 bool test44() { test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcdefghij"), 1, 4, 14); test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcdefghij"), 1, 8, 10); @@ -4802,10 +4890,12 @@ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcdefghijklmnopqrst"), 1, 1, 18); test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcdefghijklmnopqrst"), 1, 9, 10); test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcdefghijklmnopqrst"), 1, 18, 1); + + return true; } template -void test45() +TEST_CONSTEXPR_CXX20 bool test45() { test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcdefghijklmnopqrst"), 1, 19, 0); test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcdefghijklmnopqrst"), 1, 20, 0); @@ -4907,10 +4997,12 @@ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcde"), 1, 0, 0); test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcde"), 1, 1, -1); test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcde"), 1, 2, -2); + + return true; } template -void test46() +TEST_CONSTEXPR_CXX20 bool test46() { test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcde"), 1, 3, -3); test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcde"), 1, 4, -4); @@ -5012,10 +5104,12 @@ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcdefghij"), 1, 8, 9); test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcdefghij"), 1, 9, 9); test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcdefghij"), 1, 10, 9); + + return true; } template -void test47() +TEST_CONSTEXPR_CXX20 bool test47() { test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcdefghij"), 5, 0, 1); test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcdefghij"), 5, 1, 5); @@ -5117,10 +5211,12 @@ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcdefghijklmnopqrst"), 1, 20, 9); test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcdefghijklmnopqrst"), 10, 0, 5); test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcdefghijklmnopqrst"), 10, 1, 4); + + return true; } template -void test48() +TEST_CONSTEXPR_CXX20 bool test48() { test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcdefghijklmnopqrst"), 10, 5, 0); test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcdefghijklmnopqrst"), 10, 9, -4); @@ -5222,10 +5318,12 @@ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcde"), 1, 4, 9); test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcde"), 1, 5, 9); test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcde"), 2, 0, 10); + + return true; } template -void test49() +TEST_CONSTEXPR_CXX20 bool test49() { test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcde"), 2, 1, 8); test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcde"), 2, 2, 8); @@ -5327,10 +5425,12 @@ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcdefghij"), 5, 1, 5); test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcdefghij"), 5, 2, 5); test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcdefghij"), 5, 4, 5); + + return true; } template -void test50() +TEST_CONSTEXPR_CXX20 bool test50() { test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcdefghij"), 5, 5, 5); test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcdefghij"), 5, 6, 5); @@ -5432,10 +5532,12 @@ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcdefghijklmnopqrst"), 10, 9, -9); test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcdefghijklmnopqrst"), 10, 10, -10); test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcdefghijklmnopqrst"), 10, 11, -10); + + return true; } template -void test51() +TEST_CONSTEXPR_CXX20 bool test51() { test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcdefghijklmnopqrst"), 19, 0, 0); test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcdefghijklmnopqrst"), 19, 1, -1); @@ -5537,10 +5639,12 @@ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcde"), 2, 2, 17); test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcde"), 2, 3, 17); test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcde"), 2, 4, 17); + + return true; } template -void test52() +TEST_CONSTEXPR_CXX20 bool test52() { test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcde"), 4, 0, 1); test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcde"), 4, 1, 15); @@ -5642,10 +5746,12 @@ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcdefghij"), 5, 6, -5); test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcdefghij"), 9, 0, 0); test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcdefghij"), 9, 1, -1); + + return true; } template -void test53() +TEST_CONSTEXPR_CXX20 bool test53() { test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcdefghij"), 9, 2, -1); test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcdefghij"), 10, 0, 0); @@ -5747,10 +5853,12 @@ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcdefghijklmnopqrst"), 19, 1, -1); test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcdefghijklmnopqrst"), 19, 2, -1); test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcdefghijklmnopqrst"), 20, 0, 0); + + return true; } template -void test54() +TEST_CONSTEXPR_CXX20 bool test54() { test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcdefghijklmnopqrst"), 20, 1, 0); test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcdefghijklmnopqrst"), 21, 0, 0); @@ -5828,16 +5936,20 @@ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcdefghijklmnopqrst"), 20, 0, 0); test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcdefghijklmnopqrst"), 20, 1, 0); test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcdefghijklmnopqrst"), 21, 0, 0); + + return true; } template -void test55() +TEST_CONSTEXPR_CXX20 bool test55() { test_npos(S(""), 0, 0, SV(""), 0, 0); test_npos(S(""), 0, 0, SV("abcde"), 0, -5); test_npos(S("abcde"), 0, 0, SV("abcdefghij"), 0, -10); test_npos(S("abcde"), 0, 0, SV("abcdefghij"), 1, -9); test_npos(S("abcde"), 0, 0, SV("abcdefghij"), 5, -5); + + return true; } int main(int, char**) diff --git a/libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_pointer.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_pointer.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_pointer.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_pointer.pass.cpp @@ -18,7 +18,7 @@ #include "test_macros.h" -int sign(int x) +TEST_CONSTEXPR_CXX20 int sign(int x) { if (x == 0) return 0; @@ -28,7 +28,7 @@ } template -void +TEST_CONSTEXPR_CXX20 void test(const S& s, typename S::size_type pos1, typename S::size_type n1, const typename S::value_type* str, int x) { @@ -361,21 +361,30 @@ test(S("abcdefghijklmnopqrst"), 21, 0, "abcdefghijklmnopqrst", 0); } -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.ops/string_compare/size_size_pointer_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_pointer_size.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_pointer_size.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_pointer_size.pass.cpp @@ -18,7 +18,7 @@ #include "test_macros.h" -int sign(int x) +TEST_CONSTEXPR_CXX20 int sign(int x) { if (x == 0) return 0; @@ -28,7 +28,7 @@ } template -void +TEST_CONSTEXPR_CXX20 void test(const S& s, typename S::size_type pos, typename S::size_type n1, const typename S::value_type* str, typename S::size_type n2, int x) { @@ -51,7 +51,7 @@ } template -void test0() +TEST_CONSTEXPR_CXX20 bool test0() { test(S(""), 0, 0, "", 0, 0); test(S(""), 0, 0, "abcde", 0, 0); @@ -153,10 +153,12 @@ test(S("abcde"), 0, 4, "abcde", 0, 4); test(S("abcde"), 0, 4, "abcde", 1, 3); test(S("abcde"), 0, 4, "abcde", 2, 2); + + return true; } template -void test1() +TEST_CONSTEXPR_CXX20 bool test1() { test(S("abcde"), 0, 4, "abcde", 4, 0); test(S("abcde"), 0, 4, "abcde", 5, -1); @@ -258,10 +260,12 @@ test(S("abcde"), 1, 3, "abcde", 5, 1); test(S("abcde"), 1, 3, "abcdefghij", 0, 3); test(S("abcde"), 1, 3, "abcdefghij", 1, 1); + + return true; } template -void test2() +TEST_CONSTEXPR_CXX20 bool test2() { test(S("abcde"), 1, 3, "abcdefghij", 5, 1); test(S("abcde"), 1, 3, "abcdefghij", 9, 1); @@ -363,10 +367,12 @@ test(S("abcde"), 2, 3, "abcdefghij", 9, 2); test(S("abcde"), 2, 3, "abcdefghij", 10, 2); test(S("abcde"), 2, 3, "abcdefghijklmnopqrst", 0, 3); + + return true; } template -void test3() +TEST_CONSTEXPR_CXX20 bool test3() { test(S("abcde"), 2, 3, "abcdefghijklmnopqrst", 1, 2); test(S("abcde"), 2, 3, "abcdefghijklmnopqrst", 10, 2); @@ -468,10 +474,12 @@ test(S("abcde"), 5, 1, "abcdefghijklmnopqrst", 10, -10); test(S("abcde"), 5, 1, "abcdefghijklmnopqrst", 19, -19); test(S("abcde"), 5, 1, "abcdefghijklmnopqrst", 20, -20); + + return true; } template -void test4() +TEST_CONSTEXPR_CXX20 bool test4() { test(S("abcde"), 6, 0, "", 0, 0); test(S("abcde"), 6, 0, "abcde", 0, 0); @@ -573,10 +581,12 @@ test(S("abcdefghij"), 0, 11, "abcde", 0, 10); test(S("abcdefghij"), 0, 11, "abcde", 1, 9); test(S("abcdefghij"), 0, 11, "abcde", 2, 8); + + return true; } template -void test5() +TEST_CONSTEXPR_CXX20 bool test5() { test(S("abcdefghij"), 0, 11, "abcde", 4, 6); test(S("abcdefghij"), 0, 11, "abcde", 5, 5); @@ -678,10 +688,12 @@ test(S("abcdefghij"), 1, 10, "abcde", 5, 1); test(S("abcdefghij"), 1, 10, "abcdefghij", 0, 9); test(S("abcdefghij"), 1, 10, "abcdefghij", 1, 1); + + return true; } template -void test6() +TEST_CONSTEXPR_CXX20 bool test6() { test(S("abcdefghij"), 1, 10, "abcdefghij", 5, 1); test(S("abcdefghij"), 1, 10, "abcdefghij", 9, 1); @@ -783,10 +795,12 @@ test(S("abcdefghij"), 5, 6, "abcdefghij", 9, 5); test(S("abcdefghij"), 5, 6, "abcdefghij", 10, 5); test(S("abcdefghij"), 5, 6, "abcdefghijklmnopqrst", 0, 5); + + return true; } template -void test7() +TEST_CONSTEXPR_CXX20 bool test7() { test(S("abcdefghij"), 5, 6, "abcdefghijklmnopqrst", 1, 5); test(S("abcdefghij"), 5, 6, "abcdefghijklmnopqrst", 10, 5); @@ -888,10 +902,12 @@ test(S("abcdefghij"), 11, 0, "abcdefghijklmnopqrst", 10, 0); test(S("abcdefghij"), 11, 0, "abcdefghijklmnopqrst", 19, 0); test(S("abcdefghij"), 11, 0, "abcdefghijklmnopqrst", 20, 0); + + return true; } template -void test8() +TEST_CONSTEXPR_CXX20 bool test8() { test(S("abcdefghijklmnopqrst"), 0, 0, "", 0, 0); test(S("abcdefghijklmnopqrst"), 0, 0, "abcde", 0, 0); @@ -993,10 +1009,12 @@ test(S("abcdefghijklmnopqrst"), 1, 0, "abcde", 0, 0); test(S("abcdefghijklmnopqrst"), 1, 0, "abcde", 1, -1); test(S("abcdefghijklmnopqrst"), 1, 0, "abcde", 2, -2); + + return true; } template -void test9() +TEST_CONSTEXPR_CXX20 bool test9() { test(S("abcdefghijklmnopqrst"), 1, 0, "abcde", 4, -4); test(S("abcdefghijklmnopqrst"), 1, 0, "abcde", 5, -5); @@ -1098,10 +1116,12 @@ test(S("abcdefghijklmnopqrst"), 10, 0, "abcde", 5, -5); test(S("abcdefghijklmnopqrst"), 10, 0, "abcdefghij", 0, 0); test(S("abcdefghijklmnopqrst"), 10, 0, "abcdefghij", 1, -1); + + return true; } template -void test10() +TEST_CONSTEXPR_CXX20 bool test10() { test(S("abcdefghijklmnopqrst"), 10, 0, "abcdefghij", 5, -5); test(S("abcdefghijklmnopqrst"), 10, 0, "abcdefghij", 9, -9); @@ -1203,10 +1223,12 @@ test(S("abcdefghijklmnopqrst"), 19, 0, "abcdefghij", 9, -9); test(S("abcdefghijklmnopqrst"), 19, 0, "abcdefghij", 10, -10); test(S("abcdefghijklmnopqrst"), 19, 0, "abcdefghijklmnopqrst", 0, 0); + + return true; } template -void test11() +TEST_CONSTEXPR_CXX20 bool test11() { test(S("abcdefghijklmnopqrst"), 19, 0, "abcdefghijklmnopqrst", 1, -1); test(S("abcdefghijklmnopqrst"), 19, 0, "abcdefghijklmnopqrst", 10, -10); @@ -1292,41 +1314,44 @@ test(S("abcdefghijklmnopqrst"), 21, 0, "abcdefghijklmnopqrst", 10, 0); test(S("abcdefghijklmnopqrst"), 21, 0, "abcdefghijklmnopqrst", 19, 0); test(S("abcdefghijklmnopqrst"), 21, 0, "abcdefghijklmnopqrst", 20, 0); + + return true; +} + +template +void test() { + test0(); + test1(); + test2(); + test3(); + test4(); + test5(); + test6(); + test7(); + test8(); + test9(); + test10(); + test11(); + + // 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()); } 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.ops/string_compare/size_size_string.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_string.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_string.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_string.pass.cpp @@ -360,28 +360,37 @@ test(S("abcdefghijklmnopqrst"), 21, 0, S("abcdefghijklmnopqrst"), 0); } -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 = " !"; assert(s.compare(0, 1, {"abc", 1}) < 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.ops/string_compare/size_size_string_size_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_string_size_size.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_string_size_size.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_string_size_size.pass.cpp @@ -20,7 +20,7 @@ #include "test_macros.h" -int sign(int x) +TEST_CONSTEXPR_CXX20 int sign(int x) { if (x == 0) return 0; @@ -30,7 +30,7 @@ } template -void +TEST_CONSTEXPR_CXX20 void test(const S& s, typename S::size_type pos1, typename S::size_type n1, const S& str, typename S::size_type pos2, typename S::size_type n2, int x) { @@ -76,7 +76,7 @@ } template -void test0() +TEST_CONSTEXPR_CXX20 bool test0() { test(S(""), 0, 0, S(""), 0, 0, 0); test(S(""), 0, 0, S(""), 0, 1, 0); @@ -178,10 +178,12 @@ test(S(""), 0, 1, S("abcde"), 5, 0, 0); test(S(""), 0, 1, S("abcde"), 5, 1, 0); test(S(""), 0, 1, S("abcde"), 6, 0, 0); + + return true; } template -void test1() +TEST_CONSTEXPR_CXX20 bool test1() { test(S(""), 0, 1, S("abcdefghij"), 0, 0, 0); test(S(""), 0, 1, S("abcdefghij"), 0, 1, -1); @@ -283,10 +285,12 @@ test(S(""), 1, 0, S("abcdefghij"), 11, 0, 0); test(S(""), 1, 0, S("abcdefghijklmnopqrst"), 0, 0, 0); test(S(""), 1, 0, S("abcdefghijklmnopqrst"), 0, 1, 0); + + return true; } template -void test2() +TEST_CONSTEXPR_CXX20 bool test2() { test(S(""), 1, 0, S("abcdefghijklmnopqrst"), 0, 10, 0); test(S(""), 1, 0, S("abcdefghijklmnopqrst"), 0, 19, 0); @@ -388,10 +392,12 @@ test(S("abcde"), 0, 1, S(""), 0, 1, 1); test(S("abcde"), 0, 1, S(""), 1, 0, 0); test(S("abcde"), 0, 1, S("abcde"), 0, 0, 1); + + return true; } template -void test3() +TEST_CONSTEXPR_CXX20 bool test3() { test(S("abcde"), 0, 1, S("abcde"), 0, 1, 0); test(S("abcde"), 0, 1, S("abcde"), 0, 2, -1); @@ -493,10 +499,12 @@ test(S("abcde"), 0, 2, S("abcdefghij"), 0, 1, 1); test(S("abcde"), 0, 2, S("abcdefghij"), 0, 5, -3); test(S("abcde"), 0, 2, S("abcdefghij"), 0, 9, -7); + + return true; } template -void test4() +TEST_CONSTEXPR_CXX20 bool test4() { test(S("abcde"), 0, 2, S("abcdefghij"), 0, 10, -8); test(S("abcde"), 0, 2, S("abcdefghij"), 0, 11, -8); @@ -598,10 +606,12 @@ test(S("abcde"), 0, 4, S("abcdefghijklmnopqrst"), 0, 19, -15); test(S("abcde"), 0, 4, S("abcdefghijklmnopqrst"), 0, 20, -16); test(S("abcde"), 0, 4, S("abcdefghijklmnopqrst"), 0, 21, -16); + + return true; } template -void test5() +TEST_CONSTEXPR_CXX20 bool test5() { test(S("abcde"), 0, 4, S("abcdefghijklmnopqrst"), 1, 0, 4); test(S("abcde"), 0, 4, S("abcdefghijklmnopqrst"), 1, 1, -1); @@ -703,10 +713,12 @@ test(S("abcde"), 0, 6, S("abcde"), 0, 2, 3); test(S("abcde"), 0, 6, S("abcde"), 0, 4, 1); test(S("abcde"), 0, 6, S("abcde"), 0, 5, 0); + + return true; } template -void test6() +TEST_CONSTEXPR_CXX20 bool test6() { test(S("abcde"), 0, 6, S("abcde"), 0, 6, 0); test(S("abcde"), 0, 6, S("abcde"), 1, 0, 5); @@ -808,10 +820,12 @@ test(S("abcde"), 1, 0, S("abcdefghij"), 0, 11, -10); test(S("abcde"), 1, 0, S("abcdefghij"), 1, 0, 0); test(S("abcde"), 1, 0, S("abcdefghij"), 1, 1, -1); + + return true; } template -void test7() +TEST_CONSTEXPR_CXX20 bool test7() { test(S("abcde"), 1, 0, S("abcdefghij"), 1, 4, -4); test(S("abcde"), 1, 0, S("abcdefghij"), 1, 8, -8); @@ -913,10 +927,12 @@ test(S("abcde"), 1, 1, S("abcdefghijklmnopqrst"), 1, 1, 0); test(S("abcde"), 1, 1, S("abcdefghijklmnopqrst"), 1, 9, -8); test(S("abcde"), 1, 1, S("abcdefghijklmnopqrst"), 1, 18, -17); + + return true; } template -void test8() +TEST_CONSTEXPR_CXX20 bool test8() { test(S("abcde"), 1, 1, S("abcdefghijklmnopqrst"), 1, 19, -18); test(S("abcde"), 1, 1, S("abcdefghijklmnopqrst"), 1, 20, -18); @@ -1018,10 +1034,12 @@ test(S("abcde"), 1, 3, S("abcde"), 1, 0, 3); test(S("abcde"), 1, 3, S("abcde"), 1, 1, 2); test(S("abcde"), 1, 3, S("abcde"), 1, 2, 1); + + return true; } template -void test9() +TEST_CONSTEXPR_CXX20 bool test9() { test(S("abcde"), 1, 3, S("abcde"), 1, 3, 0); test(S("abcde"), 1, 3, S("abcde"), 1, 4, -1); @@ -1123,10 +1141,12 @@ test(S("abcde"), 1, 4, S("abcdefghij"), 1, 8, -4); test(S("abcde"), 1, 4, S("abcdefghij"), 1, 9, -5); test(S("abcde"), 1, 4, S("abcdefghij"), 1, 10, -5); + + return true; } template -void test10() +TEST_CONSTEXPR_CXX20 bool test10() { test(S("abcde"), 1, 4, S("abcdefghij"), 5, 0, 4); test(S("abcde"), 1, 4, S("abcdefghij"), 5, 1, -4); @@ -1228,10 +1248,12 @@ test(S("abcde"), 1, 5, S("abcdefghijklmnopqrst"), 1, 20, -15); test(S("abcde"), 1, 5, S("abcdefghijklmnopqrst"), 10, 0, 4); test(S("abcde"), 1, 5, S("abcdefghijklmnopqrst"), 10, 1, -9); + + return true; } template -void test11() +TEST_CONSTEXPR_CXX20 bool test11() { test(S("abcde"), 1, 5, S("abcdefghijklmnopqrst"), 10, 5, -9); test(S("abcde"), 1, 5, S("abcdefghijklmnopqrst"), 10, 9, -9); @@ -1333,10 +1355,12 @@ test(S("abcde"), 2, 1, S("abcde"), 1, 4, 1); test(S("abcde"), 2, 1, S("abcde"), 1, 5, 1); test(S("abcde"), 2, 1, S("abcde"), 2, 0, 1); + + return true; } template -void test12() +TEST_CONSTEXPR_CXX20 bool test12() { test(S("abcde"), 2, 1, S("abcde"), 2, 1, 0); test(S("abcde"), 2, 1, S("abcde"), 2, 2, -1); @@ -1438,10 +1462,12 @@ test(S("abcde"), 2, 2, S("abcdefghij"), 5, 1, -3); test(S("abcde"), 2, 2, S("abcdefghij"), 5, 2, -3); test(S("abcde"), 2, 2, S("abcdefghij"), 5, 4, -3); + + return true; } template -void test13() +TEST_CONSTEXPR_CXX20 bool test13() { test(S("abcde"), 2, 2, S("abcdefghij"), 5, 5, -3); test(S("abcde"), 2, 2, S("abcdefghij"), 5, 6, -3); @@ -1543,10 +1569,12 @@ test(S("abcde"), 2, 3, S("abcdefghijklmnopqrst"), 10, 9, -8); test(S("abcde"), 2, 3, S("abcdefghijklmnopqrst"), 10, 10, -8); test(S("abcde"), 2, 3, S("abcdefghijklmnopqrst"), 10, 11, -8); + + return true; } template -void test14() +TEST_CONSTEXPR_CXX20 bool test14() { test(S("abcde"), 2, 3, S("abcdefghijklmnopqrst"), 19, 0, 3); test(S("abcde"), 2, 3, S("abcdefghijklmnopqrst"), 19, 1, -17); @@ -1648,10 +1676,12 @@ test(S("abcde"), 4, 0, S("abcde"), 2, 2, -2); test(S("abcde"), 4, 0, S("abcde"), 2, 3, -3); test(S("abcde"), 4, 0, S("abcde"), 2, 4, -3); + + return true; } template -void test15() +TEST_CONSTEXPR_CXX20 bool test15() { test(S("abcde"), 4, 0, S("abcde"), 4, 0, 0); test(S("abcde"), 4, 0, S("abcde"), 4, 1, -1); @@ -1753,10 +1783,12 @@ test(S("abcde"), 4, 1, S("abcdefghij"), 5, 6, -1); test(S("abcde"), 4, 1, S("abcdefghij"), 9, 0, 1); test(S("abcde"), 4, 1, S("abcdefghij"), 9, 1, -5); + + return true; } template -void test16() +TEST_CONSTEXPR_CXX20 bool test16() { test(S("abcde"), 4, 1, S("abcdefghij"), 9, 2, -5); test(S("abcde"), 4, 1, S("abcdefghij"), 10, 0, 1); @@ -1858,10 +1890,12 @@ test(S("abcde"), 4, 2, S("abcdefghijklmnopqrst"), 19, 1, -15); test(S("abcde"), 4, 2, S("abcdefghijklmnopqrst"), 19, 2, -15); test(S("abcde"), 4, 2, S("abcdefghijklmnopqrst"), 20, 0, 1); + + return true; } template -void test17() +TEST_CONSTEXPR_CXX20 bool test17() { test(S("abcde"), 4, 2, S("abcdefghijklmnopqrst"), 20, 1, 1); test(S("abcde"), 4, 2, S("abcdefghijklmnopqrst"), 21, 0, 0); @@ -1963,10 +1997,12 @@ test(S("abcde"), 5, 1, S("abcde"), 4, 1, -1); test(S("abcde"), 5, 1, S("abcde"), 4, 2, -1); test(S("abcde"), 5, 1, S("abcde"), 5, 0, 0); + + return true; } template -void test18() +TEST_CONSTEXPR_CXX20 bool test18() { test(S("abcde"), 5, 1, S("abcde"), 5, 1, 0); test(S("abcde"), 5, 1, S("abcde"), 6, 0, 0); @@ -2068,10 +2104,12 @@ test(S("abcde"), 6, 0, S("abcdefghij"), 10, 0, 0); test(S("abcde"), 6, 0, S("abcdefghij"), 10, 1, 0); test(S("abcde"), 6, 0, S("abcdefghij"), 11, 0, 0); + + return true; } template -void test19() +TEST_CONSTEXPR_CXX20 bool test19() { test(S("abcde"), 6, 0, S("abcdefghijklmnopqrst"), 0, 0, 0); test(S("abcde"), 6, 0, S("abcdefghijklmnopqrst"), 0, 1, 0); @@ -2173,10 +2211,12 @@ test(S("abcdefghij"), 0, 0, S("abcdefghijklmnopqrst"), 21, 0, 0); test(S("abcdefghij"), 0, 1, S(""), 0, 0, 1); test(S("abcdefghij"), 0, 1, S(""), 0, 1, 1); + + return true; } template -void test20() +TEST_CONSTEXPR_CXX20 bool test20() { test(S("abcdefghij"), 0, 1, S(""), 1, 0, 0); test(S("abcdefghij"), 0, 1, S("abcde"), 0, 0, 1); @@ -2278,10 +2318,12 @@ test(S("abcdefghij"), 0, 5, S("abcde"), 6, 0, 0); test(S("abcdefghij"), 0, 5, S("abcdefghij"), 0, 0, 5); test(S("abcdefghij"), 0, 5, S("abcdefghij"), 0, 1, 4); + + return true; } template -void test21() +TEST_CONSTEXPR_CXX20 bool test21() { test(S("abcdefghij"), 0, 5, S("abcdefghij"), 0, 5, 0); test(S("abcdefghij"), 0, 5, S("abcdefghij"), 0, 9, -4); @@ -2383,10 +2425,12 @@ test(S("abcdefghij"), 0, 9, S("abcdefghijklmnopqrst"), 0, 1, 8); test(S("abcdefghij"), 0, 9, S("abcdefghijklmnopqrst"), 0, 10, -1); test(S("abcdefghij"), 0, 9, S("abcdefghijklmnopqrst"), 0, 19, -10); + + return true; } template -void test22() +TEST_CONSTEXPR_CXX20 bool test22() { test(S("abcdefghij"), 0, 9, S("abcdefghijklmnopqrst"), 0, 20, -11); test(S("abcdefghij"), 0, 9, S("abcdefghijklmnopqrst"), 0, 21, -11); @@ -2488,10 +2532,12 @@ test(S("abcdefghij"), 0, 11, S("abcde"), 0, 0, 10); test(S("abcdefghij"), 0, 11, S("abcde"), 0, 1, 9); test(S("abcdefghij"), 0, 11, S("abcde"), 0, 2, 8); + + return true; } template -void test23() +TEST_CONSTEXPR_CXX20 bool test23() { test(S("abcdefghij"), 0, 11, S("abcde"), 0, 4, 6); test(S("abcdefghij"), 0, 11, S("abcde"), 0, 5, 5); @@ -2593,10 +2639,12 @@ test(S("abcdefghij"), 1, 0, S("abcdefghij"), 0, 9, -9); test(S("abcdefghij"), 1, 0, S("abcdefghij"), 0, 10, -10); test(S("abcdefghij"), 1, 0, S("abcdefghij"), 0, 11, -10); + + return true; } template -void test24() +TEST_CONSTEXPR_CXX20 bool test24() { test(S("abcdefghij"), 1, 0, S("abcdefghij"), 1, 0, 0); test(S("abcdefghij"), 1, 0, S("abcdefghij"), 1, 1, -1); @@ -2698,10 +2746,12 @@ test(S("abcdefghij"), 1, 1, S("abcdefghijklmnopqrst"), 0, 21, 1); test(S("abcdefghij"), 1, 1, S("abcdefghijklmnopqrst"), 1, 0, 1); test(S("abcdefghij"), 1, 1, S("abcdefghijklmnopqrst"), 1, 1, 0); + + return true; } template -void test25() +TEST_CONSTEXPR_CXX20 bool test25() { test(S("abcdefghij"), 1, 1, S("abcdefghijklmnopqrst"), 1, 9, -8); test(S("abcdefghij"), 1, 1, S("abcdefghijklmnopqrst"), 1, 18, -17); @@ -2803,10 +2853,12 @@ test(S("abcdefghij"), 1, 8, S("abcde"), 0, 5, 1); test(S("abcdefghij"), 1, 8, S("abcde"), 0, 6, 1); test(S("abcdefghij"), 1, 8, S("abcde"), 1, 0, 8); + + return true; } template -void test26() +TEST_CONSTEXPR_CXX20 bool test26() { test(S("abcdefghij"), 1, 8, S("abcde"), 1, 1, 7); test(S("abcdefghij"), 1, 8, S("abcde"), 1, 2, 6); @@ -2908,10 +2960,12 @@ test(S("abcdefghij"), 1, 9, S("abcdefghij"), 1, 1, 8); test(S("abcdefghij"), 1, 9, S("abcdefghij"), 1, 4, 5); test(S("abcdefghij"), 1, 9, S("abcdefghij"), 1, 8, 1); + + return true; } template -void test27() +TEST_CONSTEXPR_CXX20 bool test27() { test(S("abcdefghij"), 1, 9, S("abcdefghij"), 1, 9, 0); test(S("abcdefghij"), 1, 9, S("abcdefghij"), 1, 10, 0); @@ -3013,10 +3067,12 @@ test(S("abcdefghij"), 1, 10, S("abcdefghijklmnopqrst"), 1, 18, -9); test(S("abcdefghij"), 1, 10, S("abcdefghijklmnopqrst"), 1, 19, -10); test(S("abcdefghij"), 1, 10, S("abcdefghijklmnopqrst"), 1, 20, -10); + + return true; } template -void test28() +TEST_CONSTEXPR_CXX20 bool test28() { test(S("abcdefghij"), 1, 10, S("abcdefghijklmnopqrst"), 10, 0, 9); test(S("abcdefghij"), 1, 10, S("abcdefghijklmnopqrst"), 10, 1, -9); @@ -3118,10 +3174,12 @@ test(S("abcdefghij"), 5, 1, S("abcde"), 1, 2, 4); test(S("abcdefghij"), 5, 1, S("abcde"), 1, 3, 4); test(S("abcdefghij"), 5, 1, S("abcde"), 1, 4, 4); + + return true; } template -void test29() +TEST_CONSTEXPR_CXX20 bool test29() { test(S("abcdefghij"), 5, 1, S("abcde"), 1, 5, 4); test(S("abcdefghij"), 5, 1, S("abcde"), 2, 0, 1); @@ -3223,10 +3281,12 @@ test(S("abcdefghij"), 5, 2, S("abcdefghij"), 1, 10, 4); test(S("abcdefghij"), 5, 2, S("abcdefghij"), 5, 0, 2); test(S("abcdefghij"), 5, 2, S("abcdefghij"), 5, 1, 1); + + return true; } template -void test30() +TEST_CONSTEXPR_CXX20 bool test30() { test(S("abcdefghij"), 5, 2, S("abcdefghij"), 5, 2, 0); test(S("abcdefghij"), 5, 2, S("abcdefghij"), 5, 4, -2); @@ -3328,10 +3388,12 @@ test(S("abcdefghij"), 5, 4, S("abcdefghijklmnopqrst"), 10, 1, -5); test(S("abcdefghij"), 5, 4, S("abcdefghijklmnopqrst"), 10, 5, -5); test(S("abcdefghij"), 5, 4, S("abcdefghijklmnopqrst"), 10, 9, -5); + + return true; } template -void test31() +TEST_CONSTEXPR_CXX20 bool test31() { test(S("abcdefghij"), 5, 4, S("abcdefghijklmnopqrst"), 10, 10, -5); test(S("abcdefghij"), 5, 4, S("abcdefghijklmnopqrst"), 10, 11, -5); @@ -3433,10 +3495,12 @@ test(S("abcdefghij"), 5, 6, S("abcde"), 2, 0, 5); test(S("abcdefghij"), 5, 6, S("abcde"), 2, 1, 3); test(S("abcdefghij"), 5, 6, S("abcde"), 2, 2, 3); + + return true; } template -void test32() +TEST_CONSTEXPR_CXX20 bool test32() { test(S("abcdefghij"), 5, 6, S("abcde"), 2, 3, 3); test(S("abcdefghij"), 5, 6, S("abcde"), 2, 4, 3); @@ -3538,10 +3602,12 @@ test(S("abcdefghij"), 9, 0, S("abcdefghij"), 5, 4, -4); test(S("abcdefghij"), 9, 0, S("abcdefghij"), 5, 5, -5); test(S("abcdefghij"), 9, 0, S("abcdefghij"), 5, 6, -5); + + return true; } template -void test33() +TEST_CONSTEXPR_CXX20 bool test33() { test(S("abcdefghij"), 9, 0, S("abcdefghij"), 9, 0, 0); test(S("abcdefghij"), 9, 0, S("abcdefghij"), 9, 1, -1); @@ -3643,10 +3709,12 @@ test(S("abcdefghij"), 9, 1, S("abcdefghijklmnopqrst"), 10, 11, -1); test(S("abcdefghij"), 9, 1, S("abcdefghijklmnopqrst"), 19, 0, 1); test(S("abcdefghij"), 9, 1, S("abcdefghijklmnopqrst"), 19, 1, -10); + + return true; } template -void test34() +TEST_CONSTEXPR_CXX20 bool test34() { test(S("abcdefghij"), 9, 1, S("abcdefghijklmnopqrst"), 19, 2, -10); test(S("abcdefghij"), 9, 1, S("abcdefghijklmnopqrst"), 20, 0, 1); @@ -3748,10 +3816,12 @@ test(S("abcdefghij"), 10, 0, S("abcde"), 2, 4, -3); test(S("abcdefghij"), 10, 0, S("abcde"), 4, 0, 0); test(S("abcdefghij"), 10, 0, S("abcde"), 4, 1, -1); + + return true; } template -void test35() +TEST_CONSTEXPR_CXX20 bool test35() { test(S("abcdefghij"), 10, 0, S("abcde"), 4, 2, -1); test(S("abcdefghij"), 10, 0, S("abcde"), 5, 0, 0); @@ -3853,10 +3923,12 @@ test(S("abcdefghij"), 10, 1, S("abcdefghij"), 9, 1, -1); test(S("abcdefghij"), 10, 1, S("abcdefghij"), 9, 2, -1); test(S("abcdefghij"), 10, 1, S("abcdefghij"), 10, 0, 0); + + return true; } template -void test36() +TEST_CONSTEXPR_CXX20 bool test36() { test(S("abcdefghij"), 10, 1, S("abcdefghij"), 10, 1, 0); test(S("abcdefghij"), 10, 1, S("abcdefghij"), 11, 0, 0); @@ -3958,10 +4030,12 @@ test(S("abcdefghij"), 11, 0, S("abcdefghijklmnopqrst"), 20, 0, 0); test(S("abcdefghij"), 11, 0, S("abcdefghijklmnopqrst"), 20, 1, 0); test(S("abcdefghij"), 11, 0, S("abcdefghijklmnopqrst"), 21, 0, 0); + + return true; } template -void test37() +TEST_CONSTEXPR_CXX20 bool test37() { test(S("abcdefghijklmnopqrst"), 0, 0, S(""), 0, 0, 0); test(S("abcdefghijklmnopqrst"), 0, 0, S(""), 0, 1, 0); @@ -4063,10 +4137,12 @@ test(S("abcdefghijklmnopqrst"), 0, 1, S("abcde"), 5, 0, 1); test(S("abcdefghijklmnopqrst"), 0, 1, S("abcde"), 5, 1, 1); test(S("abcdefghijklmnopqrst"), 0, 1, S("abcde"), 6, 0, 0); + + return true; } template -void test38() +TEST_CONSTEXPR_CXX20 bool test38() { test(S("abcdefghijklmnopqrst"), 0, 1, S("abcdefghij"), 0, 0, 1); test(S("abcdefghijklmnopqrst"), 0, 1, S("abcdefghij"), 0, 1, 0); @@ -4168,10 +4244,12 @@ test(S("abcdefghijklmnopqrst"), 0, 10, S("abcdefghij"), 11, 0, 0); test(S("abcdefghijklmnopqrst"), 0, 10, S("abcdefghijklmnopqrst"), 0, 0, 10); test(S("abcdefghijklmnopqrst"), 0, 10, S("abcdefghijklmnopqrst"), 0, 1, 9); + + return true; } template -void test39() +TEST_CONSTEXPR_CXX20 bool test39() { test(S("abcdefghijklmnopqrst"), 0, 10, S("abcdefghijklmnopqrst"), 0, 10, 0); test(S("abcdefghijklmnopqrst"), 0, 10, S("abcdefghijklmnopqrst"), 0, 19, -9); @@ -4273,10 +4351,12 @@ test(S("abcdefghijklmnopqrst"), 0, 20, S(""), 0, 1, 20); test(S("abcdefghijklmnopqrst"), 0, 20, S(""), 1, 0, 0); test(S("abcdefghijklmnopqrst"), 0, 20, S("abcde"), 0, 0, 20); + + return true; } template -void test40() +TEST_CONSTEXPR_CXX20 bool test40() { test(S("abcdefghijklmnopqrst"), 0, 20, S("abcde"), 0, 1, 19); test(S("abcdefghijklmnopqrst"), 0, 20, S("abcde"), 0, 2, 18); @@ -4378,10 +4458,12 @@ test(S("abcdefghijklmnopqrst"), 0, 21, S("abcdefghij"), 0, 1, 19); test(S("abcdefghijklmnopqrst"), 0, 21, S("abcdefghij"), 0, 5, 15); test(S("abcdefghijklmnopqrst"), 0, 21, S("abcdefghij"), 0, 9, 11); + + return true; } template -void test41() +TEST_CONSTEXPR_CXX20 bool test41() { test(S("abcdefghijklmnopqrst"), 0, 21, S("abcdefghij"), 0, 10, 10); test(S("abcdefghijklmnopqrst"), 0, 21, S("abcdefghij"), 0, 11, 10); @@ -4483,10 +4565,12 @@ test(S("abcdefghijklmnopqrst"), 1, 0, S("abcdefghijklmnopqrst"), 0, 19, -19); test(S("abcdefghijklmnopqrst"), 1, 0, S("abcdefghijklmnopqrst"), 0, 20, -20); test(S("abcdefghijklmnopqrst"), 1, 0, S("abcdefghijklmnopqrst"), 0, 21, -20); + + return true; } template -void test42() +TEST_CONSTEXPR_CXX20 bool test42() { test(S("abcdefghijklmnopqrst"), 1, 0, S("abcdefghijklmnopqrst"), 1, 0, 0); test(S("abcdefghijklmnopqrst"), 1, 0, S("abcdefghijklmnopqrst"), 1, 1, -1); @@ -4588,10 +4672,12 @@ test(S("abcdefghijklmnopqrst"), 1, 9, S("abcde"), 0, 2, 1); test(S("abcdefghijklmnopqrst"), 1, 9, S("abcde"), 0, 4, 1); test(S("abcdefghijklmnopqrst"), 1, 9, S("abcde"), 0, 5, 1); + + return true; } template -void test43() +TEST_CONSTEXPR_CXX20 bool test43() { test(S("abcdefghijklmnopqrst"), 1, 9, S("abcde"), 0, 6, 1); test(S("abcdefghijklmnopqrst"), 1, 9, S("abcde"), 1, 0, 9); @@ -4693,10 +4779,12 @@ test(S("abcdefghijklmnopqrst"), 1, 18, S("abcdefghij"), 0, 11, 1); test(S("abcdefghijklmnopqrst"), 1, 18, S("abcdefghij"), 1, 0, 18); test(S("abcdefghijklmnopqrst"), 1, 18, S("abcdefghij"), 1, 1, 17); + + return true; } template -void test44() +TEST_CONSTEXPR_CXX20 bool test44() { test(S("abcdefghijklmnopqrst"), 1, 18, S("abcdefghij"), 1, 4, 14); test(S("abcdefghijklmnopqrst"), 1, 18, S("abcdefghij"), 1, 8, 10); @@ -4798,10 +4886,12 @@ test(S("abcdefghijklmnopqrst"), 1, 19, S("abcdefghijklmnopqrst"), 1, 1, 18); test(S("abcdefghijklmnopqrst"), 1, 19, S("abcdefghijklmnopqrst"), 1, 9, 10); test(S("abcdefghijklmnopqrst"), 1, 19, S("abcdefghijklmnopqrst"), 1, 18, 1); + + return true; } template -void test45() +TEST_CONSTEXPR_CXX20 bool test45() { test(S("abcdefghijklmnopqrst"), 1, 19, S("abcdefghijklmnopqrst"), 1, 19, 0); test(S("abcdefghijklmnopqrst"), 1, 19, S("abcdefghijklmnopqrst"), 1, 20, 0); @@ -4903,10 +4993,12 @@ test(S("abcdefghijklmnopqrst"), 10, 0, S("abcde"), 1, 0, 0); test(S("abcdefghijklmnopqrst"), 10, 0, S("abcde"), 1, 1, -1); test(S("abcdefghijklmnopqrst"), 10, 0, S("abcde"), 1, 2, -2); + + return true; } template -void test46() +TEST_CONSTEXPR_CXX20 bool test46() { test(S("abcdefghijklmnopqrst"), 10, 0, S("abcde"), 1, 3, -3); test(S("abcdefghijklmnopqrst"), 10, 0, S("abcde"), 1, 4, -4); @@ -5008,10 +5100,12 @@ test(S("abcdefghijklmnopqrst"), 10, 1, S("abcdefghij"), 1, 8, 9); test(S("abcdefghijklmnopqrst"), 10, 1, S("abcdefghij"), 1, 9, 9); test(S("abcdefghijklmnopqrst"), 10, 1, S("abcdefghij"), 1, 10, 9); + + return true; } template -void test47() +TEST_CONSTEXPR_CXX20 bool test47() { test(S("abcdefghijklmnopqrst"), 10, 1, S("abcdefghij"), 5, 0, 1); test(S("abcdefghijklmnopqrst"), 10, 1, S("abcdefghij"), 5, 1, 5); @@ -5113,10 +5207,12 @@ test(S("abcdefghijklmnopqrst"), 10, 5, S("abcdefghijklmnopqrst"), 1, 20, 9); test(S("abcdefghijklmnopqrst"), 10, 5, S("abcdefghijklmnopqrst"), 10, 0, 5); test(S("abcdefghijklmnopqrst"), 10, 5, S("abcdefghijklmnopqrst"), 10, 1, 4); + + return true; } template -void test48() +TEST_CONSTEXPR_CXX20 bool test48() { test(S("abcdefghijklmnopqrst"), 10, 5, S("abcdefghijklmnopqrst"), 10, 5, 0); test(S("abcdefghijklmnopqrst"), 10, 5, S("abcdefghijklmnopqrst"), 10, 9, -4); @@ -5218,10 +5314,12 @@ test(S("abcdefghijklmnopqrst"), 10, 10, S("abcde"), 1, 4, 9); test(S("abcdefghijklmnopqrst"), 10, 10, S("abcde"), 1, 5, 9); test(S("abcdefghijklmnopqrst"), 10, 10, S("abcde"), 2, 0, 10); + + return true; } template -void test49() +TEST_CONSTEXPR_CXX20 bool test49() { test(S("abcdefghijklmnopqrst"), 10, 10, S("abcde"), 2, 1, 8); test(S("abcdefghijklmnopqrst"), 10, 10, S("abcde"), 2, 2, 8); @@ -5323,10 +5421,12 @@ test(S("abcdefghijklmnopqrst"), 10, 11, S("abcdefghij"), 5, 1, 5); test(S("abcdefghijklmnopqrst"), 10, 11, S("abcdefghij"), 5, 2, 5); test(S("abcdefghijklmnopqrst"), 10, 11, S("abcdefghij"), 5, 4, 5); + + return true; } template -void test50() +TEST_CONSTEXPR_CXX20 bool test50() { test(S("abcdefghijklmnopqrst"), 10, 11, S("abcdefghij"), 5, 5, 5); test(S("abcdefghijklmnopqrst"), 10, 11, S("abcdefghij"), 5, 6, 5); @@ -5428,10 +5528,12 @@ test(S("abcdefghijklmnopqrst"), 19, 0, S("abcdefghijklmnopqrst"), 10, 9, -9); test(S("abcdefghijklmnopqrst"), 19, 0, S("abcdefghijklmnopqrst"), 10, 10, -10); test(S("abcdefghijklmnopqrst"), 19, 0, S("abcdefghijklmnopqrst"), 10, 11, -10); + + return true; } template -void test51() +TEST_CONSTEXPR_CXX20 bool test51() { test(S("abcdefghijklmnopqrst"), 19, 0, S("abcdefghijklmnopqrst"), 19, 0, 0); test(S("abcdefghijklmnopqrst"), 19, 0, S("abcdefghijklmnopqrst"), 19, 1, -1); @@ -5533,10 +5635,12 @@ test(S("abcdefghijklmnopqrst"), 19, 2, S("abcde"), 2, 2, 17); test(S("abcdefghijklmnopqrst"), 19, 2, S("abcde"), 2, 3, 17); test(S("abcdefghijklmnopqrst"), 19, 2, S("abcde"), 2, 4, 17); + + return true; } template -void test52() +TEST_CONSTEXPR_CXX20 bool test52() { test(S("abcdefghijklmnopqrst"), 19, 2, S("abcde"), 4, 0, 1); test(S("abcdefghijklmnopqrst"), 19, 2, S("abcde"), 4, 1, 15); @@ -5638,10 +5742,12 @@ test(S("abcdefghijklmnopqrst"), 20, 0, S("abcdefghij"), 5, 6, -5); test(S("abcdefghijklmnopqrst"), 20, 0, S("abcdefghij"), 9, 0, 0); test(S("abcdefghijklmnopqrst"), 20, 0, S("abcdefghij"), 9, 1, -1); + + return true; } template -void test53() +TEST_CONSTEXPR_CXX20 bool test53() { test(S("abcdefghijklmnopqrst"), 20, 0, S("abcdefghij"), 9, 2, -1); test(S("abcdefghijklmnopqrst"), 20, 0, S("abcdefghij"), 10, 0, 0); @@ -5743,10 +5849,12 @@ test(S("abcdefghijklmnopqrst"), 20, 1, S("abcdefghijklmnopqrst"), 19, 1, -1); test(S("abcdefghijklmnopqrst"), 20, 1, S("abcdefghijklmnopqrst"), 19, 2, -1); test(S("abcdefghijklmnopqrst"), 20, 1, S("abcdefghijklmnopqrst"), 20, 0, 0); + + return true; } template -void test54() +TEST_CONSTEXPR_CXX20 bool test54() { test(S("abcdefghijklmnopqrst"), 20, 1, S("abcdefghijklmnopqrst"), 20, 1, 0); test(S("abcdefghijklmnopqrst"), 20, 1, S("abcdefghijklmnopqrst"), 21, 0, 0); @@ -5824,139 +5932,144 @@ test(S("abcdefghijklmnopqrst"), 21, 0, S("abcdefghijklmnopqrst"), 20, 0, 0); test(S("abcdefghijklmnopqrst"), 21, 0, S("abcdefghijklmnopqrst"), 20, 1, 0); test(S("abcdefghijklmnopqrst"), 21, 0, S("abcdefghijklmnopqrst"), 21, 0, 0); + + return true; } template -void test55() +TEST_CONSTEXPR_CXX20 bool test55() { test_npos(S(""), 0, 0, S(""), 0, 0); test_npos(S(""), 0, 0, S("abcde"), 0, -5); test_npos(S("abcde"), 0, 0, S("abcdefghij"), 0, -10); test_npos(S("abcde"), 0, 0, S("abcdefghij"), 1, -9); test_npos(S("abcde"), 0, 0, S("abcdefghij"), 5, -5); + + 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(); + + // 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()); } 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.ops/string_compare/size_size_string_view.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_string_view.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_string_view.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_string_view.pass.cpp @@ -18,7 +18,7 @@ #include "test_macros.h" -int sign(int x) +TEST_CONSTEXPR_CXX20 int sign(int x) { if (x == 0) return 0; @@ -28,7 +28,7 @@ } template -void +TEST_CONSTEXPR_CXX20 void test(const S& s, typename S::size_type pos1, typename S::size_type n1, SV sv, int x) { @@ -51,7 +51,7 @@ } template -void test0() +TEST_CONSTEXPR_CXX20 void test0() { test(S(""), 0, 0, SV(""), 0); test(S(""), 0, 0, SV("abcde"), -5); @@ -156,7 +156,7 @@ } template -void test1() +TEST_CONSTEXPR_CXX20 void test1() { test(S("abcde"), 6, 0, SV(""), 0); test(S("abcde"), 6, 0, SV("abcde"), 0); @@ -261,7 +261,7 @@ } template -void test2() +TEST_CONSTEXPR_CXX20 void test2() { test(S("abcdefghijklmnopqrst"), 0, 0, SV(""), 0); test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcde"), -5); @@ -361,23 +361,32 @@ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcdefghijklmnopqrst"), 0); } -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.ops/string_compare/string.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_compare/string.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.ops/string_compare/string.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.ops/string_compare/string.pass.cpp @@ -16,7 +16,7 @@ #include "test_macros.h" #include "min_allocator.h" -int sign(int x) +TEST_CONSTEXPR_CXX20 int sign(int x) { if (x == 0) return 0; @@ -26,16 +26,15 @@ } template -void +TEST_CONSTEXPR_CXX20 void test(const S& s, const S& str, int x) { LIBCPP_ASSERT_NOEXCEPT(s.compare(str)); assert(sign(s.compare(str)) == sign(x)); } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; test(S(""), S(""), 0); test(S(""), S("abcde"), -5); @@ -53,9 +52,9 @@ test(S("abcdefghijklmnopqrst"), S("abcde"), 15); test(S("abcdefghijklmnopqrst"), S("abcdefghij"), 10); test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), 0); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; test(S(""), S(""), 0); test(S(""), S("abcde"), -5); @@ -73,14 +72,24 @@ test(S("abcdefghijklmnopqrst"), S("abcde"), 15); test(S("abcdefghijklmnopqrst"), S("abcdefghij"), 10); test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), 0); - } + } #endif #if TEST_STD_VER > 3 - { // LWG 2946 + { // LWG 2946 std::string s = " !"; assert(s.compare({"abc", 1}) < 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.ops/string_compare/string_view.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_compare/string_view.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.ops/string_compare/string_view.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.ops/string_compare/string_view.pass.cpp @@ -16,7 +16,7 @@ #include "test_macros.h" #include "min_allocator.h" -int sign(int x) +TEST_CONSTEXPR_CXX20 int sign(int x) { if (x == 0) return 0; @@ -26,16 +26,15 @@ } template -void +TEST_CONSTEXPR_CXX20 void test(const S& s, SV sv, int x) { LIBCPP_ASSERT_NOEXCEPT(s.compare(sv)); assert(sign(s.compare(sv)) == sign(x)); } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; typedef std::string_view SV; test(S(""), SV(""), 0); @@ -54,9 +53,9 @@ test(S("abcdefghijklmnopqrst"), SV("abcde"), 15); test(S("abcdefghijklmnopqrst"), SV("abcdefghij"), 10); test(S("abcdefghijklmnopqrst"), SV("abcdefghijklmnopqrst"), 0); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; typedef std::string_view SV; test(S(""), SV(""), 0); @@ -75,7 +74,17 @@ test(S("abcdefghijklmnopqrst"), SV("abcde"), 15); test(S("abcdefghijklmnopqrst"), SV("abcdefghij"), 10); test(S("abcdefghijklmnopqrst"), SV("abcdefghijklmnopqrst"), 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.ops/string_find.first.not.of/char_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_find.first.not.of/char_size.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.ops/string_find.first.not.of/char_size.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.ops/string_find.first.not.of/char_size.pass.cpp @@ -17,7 +17,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(const S& s, typename S::value_type c, typename S::size_type pos, typename S::size_type x) { @@ -28,7 +28,7 @@ } template -void +TEST_CONSTEXPR_CXX20 void test(const S& s, typename S::value_type c, typename S::size_type x) { LIBCPP_ASSERT_NOEXCEPT(s.find_first_not_of(c)); @@ -37,9 +37,8 @@ assert(x < s.size()); } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; test(S(""), 'q', 0, S::npos); test(S(""), 'q', 1, S::npos); @@ -68,9 +67,9 @@ test(S("csope"), 'q', 0); test(S("gfsmthlkon"), 'q', 0); test(S("laenfsbridchgotmkqpj"), 'q', 0); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; test(S(""), 'q', 0, S::npos); test(S(""), 'q', 1, S::npos); @@ -99,7 +98,17 @@ test(S("csope"), 'q', 0); test(S("gfsmthlkon"), 'q', 0); test(S("laenfsbridchgotmkqpj"), 'q', 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.ops/string_find.first.not.of/pointer_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_find.first.not.of/pointer_size.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.ops/string_find.first.not.of/pointer_size.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.ops/string_find.first.not.of/pointer_size.pass.cpp @@ -17,7 +17,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(const S& s, const typename S::value_type* str, typename S::size_type pos, typename S::size_type x) { @@ -28,7 +28,7 @@ } template -void +TEST_CONSTEXPR_CXX20 void test(const S& s, const typename S::value_type* str, typename S::size_type x) { assert(s.find_first_not_of(str) == x); @@ -37,7 +37,7 @@ } template -void test0() +TEST_CONSTEXPR_CXX20 void test0() { test(S(""), "", 0, S::npos); test(S(""), "laenf", 0, S::npos); @@ -122,7 +122,7 @@ } template -void test1() +TEST_CONSTEXPR_CXX20 void test1() { test(S(""), "", S::npos); test(S(""), "laenf", S::npos); @@ -142,19 +142,28 @@ test(S("pniotcfrhqsmgdkjbael"), "htaobedqikfplcgjsmrn", S::npos); } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; test0(); test1(); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; test0(); test1(); - } + } +#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.ops/string_find.first.not.of/pointer_size_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_find.first.not.of/pointer_size_size.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.ops/string_find.first.not.of/pointer_size_size.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.ops/string_find.first.not.of/pointer_size_size.pass.cpp @@ -17,7 +17,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(const S& s, const typename S::value_type* str, typename S::size_type pos, typename S::size_type n, typename S::size_type x) { @@ -28,7 +28,7 @@ } template -void test0() +TEST_CONSTEXPR_CXX20 void test0() { test(S(""), "", 0, 0, S::npos); test(S(""), "irkhs", 0, 0, S::npos); @@ -133,7 +133,7 @@ } template -void test1() +TEST_CONSTEXPR_CXX20 void test1() { test(S("gbhqo"), "skqne", 5, 4, S::npos); test(S("ktdor"), "kipnf", 5, 5, S::npos); @@ -238,7 +238,7 @@ } template -void test2() +TEST_CONSTEXPR_CXX20 void test2() { test(S("sdpcilonqj"), "dnjfsagktr", 10, 5, S::npos); test(S("gtfbdkqeml"), "nejaktmiqg", 10, 9, S::npos); @@ -343,7 +343,7 @@ } template -void test3() +TEST_CONSTEXPR_CXX20 void test3() { test(S("pboqganrhedjmltsicfk"), "gbkhdnpoietfcmrslajq", 20, 1, S::npos); test(S("klchabsimetjnqgorfpd"), "rtfnmbsglkjaichoqedp", 20, 10, S::npos); @@ -367,23 +367,32 @@ test(S("hnbrcplsjfgiktoedmaq"), "qprlsfojamgndekthibc", 21, 20, S::npos); } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; test0(); test1(); test2(); test3(); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; test0(); test1(); test2(); test3(); - } + } +#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.ops/string_find.first.not.of/string_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_find.first.not.of/string_size.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.ops/string_find.first.not.of/string_size.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.ops/string_find.first.not.of/string_size.pass.cpp @@ -17,7 +17,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(const S& s, const S& str, typename S::size_type pos, typename S::size_type x) { LIBCPP_ASSERT_NOEXCEPT(s.find_first_not_of(str, pos)); @@ -27,7 +27,7 @@ } template -void +TEST_CONSTEXPR_CXX20 void test(const S& s, const S& str, typename S::size_type x) { LIBCPP_ASSERT_NOEXCEPT(s.find_first_not_of(str)); @@ -37,7 +37,7 @@ } template -void test0() +TEST_CONSTEXPR_CXX20 void test0() { test(S(""), S(""), 0, S::npos); test(S(""), S("laenf"), 0, S::npos); @@ -122,7 +122,7 @@ } template -void test1() +TEST_CONSTEXPR_CXX20 void test1() { test(S(""), S(""), S::npos); test(S(""), S("laenf"), S::npos); @@ -142,26 +142,35 @@ test(S("pniotcfrhqsmgdkjbael"), S("htaobedqikfplcgjsmrn"), S::npos); } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; test0(); test1(); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; test0(); test1(); - } + } #endif #if TEST_STD_VER > 3 - { // LWG 2946 + { // LWG 2946 std::string s = " !"; assert(s.find_first_not_of({"abc", 1}) == 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.ops/string_find.first.not.of/string_view_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_find.first.not.of/string_view_size.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.ops/string_find.first.not.of/string_view_size.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.ops/string_find.first.not.of/string_view_size.pass.cpp @@ -17,7 +17,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(const S& s, SV sv, typename S::size_type pos, typename S::size_type x) { LIBCPP_ASSERT_NOEXCEPT(s.find_first_not_of(sv, pos)); @@ -27,7 +27,7 @@ } template -void +TEST_CONSTEXPR_CXX20 void test(const S& s, SV sv, typename S::size_type x) { LIBCPP_ASSERT_NOEXCEPT(s.find_first_not_of(sv)); @@ -37,7 +37,7 @@ } template -void test0() +TEST_CONSTEXPR_CXX20 void test0() { test(S(""), SV(""), 0, S::npos); test(S(""), SV("laenf"), 0, S::npos); @@ -122,7 +122,7 @@ } template -void test1() +TEST_CONSTEXPR_CXX20 void test1() { test(S(""), SV(""), S::npos); test(S(""), SV("laenf"), S::npos); @@ -142,21 +142,30 @@ test(S("pniotcfrhqsmgdkjbael"), SV("htaobedqikfplcgjsmrn"), S::npos); } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; typedef std::string_view SV; test0(); test1(); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; typedef std::string_view SV; test0(); test1(); - } + } +#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.ops/string_find.first.of/char_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_find.first.of/char_size.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.ops/string_find.first.of/char_size.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.ops/string_find.first.of/char_size.pass.cpp @@ -17,7 +17,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(const S& s, typename S::value_type c, typename S::size_type pos, typename S::size_type x) { @@ -28,7 +28,7 @@ } template -void +TEST_CONSTEXPR_CXX20 void test(const S& s, typename S::value_type c, typename S::size_type x) { LIBCPP_ASSERT_NOEXCEPT(s.find_first_of(c)); @@ -37,9 +37,8 @@ assert(x < s.size()); } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; test(S(""), 'e', 0, S::npos); test(S(""), 'e', 1, S::npos); @@ -66,9 +65,9 @@ test(S("csope"), 'e', 4); test(S("gfsmthlkon"), 'e', S::npos); test(S("laenfsbridchgotmkqpj"), 'e', 2); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; test(S(""), 'e', 0, S::npos); test(S(""), 'e', 1, S::npos); @@ -95,7 +94,17 @@ test(S("csope"), 'e', 4); test(S("gfsmthlkon"), 'e', S::npos); test(S("laenfsbridchgotmkqpj"), 'e', 2); - } + } +#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.ops/string_find.first.of/pointer_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_find.first.of/pointer_size.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.ops/string_find.first.of/pointer_size.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.ops/string_find.first.of/pointer_size.pass.cpp @@ -17,7 +17,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(const S& s, const typename S::value_type* str, typename S::size_type pos, typename S::size_type x) { @@ -28,7 +28,7 @@ } template -void +TEST_CONSTEXPR_CXX20 void test(const S& s, const typename S::value_type* str, typename S::size_type x) { LIBCPP_ASSERT_NOEXCEPT(s.find_first_of(str)); @@ -38,7 +38,7 @@ } template -void test0() +TEST_CONSTEXPR_CXX20 void test0() { test(S(""), "", 0, S::npos); test(S(""), "laenf", 0, S::npos); @@ -123,7 +123,7 @@ } template -void test1() +TEST_CONSTEXPR_CXX20 void test1() { test(S(""), "", S::npos); test(S(""), "laenf", S::npos); @@ -143,19 +143,28 @@ test(S("pniotcfrhqsmgdkjbael"), "htaobedqikfplcgjsmrn", 0); } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; test0(); test1(); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; test0(); test1(); - } + } +#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.ops/string_find.first.of/pointer_size_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_find.first.of/pointer_size_size.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.ops/string_find.first.of/pointer_size_size.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.ops/string_find.first.of/pointer_size_size.pass.cpp @@ -17,7 +17,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(const S& s, const typename S::value_type* str, typename S::size_type pos, typename S::size_type n, typename S::size_type x) { @@ -28,7 +28,7 @@ } template -void test0() +TEST_CONSTEXPR_CXX20 void test0() { test(S(""), "", 0, 0, S::npos); test(S(""), "irkhs", 0, 0, S::npos); @@ -133,7 +133,7 @@ } template -void test1() +TEST_CONSTEXPR_CXX20 void test1() { test(S("gbhqo"), "skqne", 5, 4, S::npos); test(S("ktdor"), "kipnf", 5, 5, S::npos); @@ -238,7 +238,7 @@ } template -void test2() +TEST_CONSTEXPR_CXX20 void test2() { test(S("sdpcilonqj"), "dnjfsagktr", 10, 5, S::npos); test(S("gtfbdkqeml"), "nejaktmiqg", 10, 9, S::npos); @@ -343,7 +343,7 @@ } template -void test3() +TEST_CONSTEXPR_CXX20 void test3() { test(S("pboqganrhedjmltsicfk"), "gbkhdnpoietfcmrslajq", 20, 1, S::npos); test(S("klchabsimetjnqgorfpd"), "rtfnmbsglkjaichoqedp", 20, 10, S::npos); @@ -367,23 +367,32 @@ test(S("hnbrcplsjfgiktoedmaq"), "qprlsfojamgndekthibc", 21, 20, S::npos); } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; test0(); test1(); test2(); test3(); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; test0(); test1(); test2(); test3(); - } + } +#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.ops/string_find.first.of/string_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_find.first.of/string_size.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.ops/string_find.first.of/string_size.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.ops/string_find.first.of/string_size.pass.cpp @@ -17,7 +17,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(const S& s, const S& str, typename S::size_type pos, typename S::size_type x) { LIBCPP_ASSERT_NOEXCEPT(s.find_first_of(str, pos)); @@ -27,7 +27,7 @@ } template -void +TEST_CONSTEXPR_CXX20 void test(const S& s, const S& str, typename S::size_type x) { LIBCPP_ASSERT_NOEXCEPT(s.find_first_of(str)); @@ -37,7 +37,7 @@ } template -void test0() +TEST_CONSTEXPR_CXX20 void test0() { test(S(""), S(""), 0, S::npos); test(S(""), S("laenf"), 0, S::npos); @@ -122,7 +122,7 @@ } template -void test1() +TEST_CONSTEXPR_CXX20 void test1() { test(S(""), S(""), S::npos); test(S(""), S("laenf"), S::npos); @@ -142,26 +142,35 @@ test(S("pniotcfrhqsmgdkjbael"), S("htaobedqikfplcgjsmrn"), 0); } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; test0(); test1(); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; test0(); test1(); - } + } #endif #if TEST_STD_VER > 3 - { // LWG 2946 + { // LWG 2946 std::string s = " !"; assert(s.find_first_of({"abc", 1}) == std::string::npos); - } + } +#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.ops/string_find.first.of/string_view_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_find.first.of/string_view_size.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.ops/string_find.first.of/string_view_size.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.ops/string_find.first.of/string_view_size.pass.cpp @@ -17,7 +17,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(const S& s, SV sv, typename S::size_type pos, typename S::size_type x) { LIBCPP_ASSERT_NOEXCEPT(s.find_first_of(sv, pos)); @@ -27,7 +27,7 @@ } template -void +TEST_CONSTEXPR_CXX20 void test(const S& s, SV sv, typename S::size_type x) { LIBCPP_ASSERT_NOEXCEPT(s.find_first_of(sv)); @@ -37,7 +37,7 @@ } template -void test0() +TEST_CONSTEXPR_CXX20 void test0() { test(S(""), SV(""), 0, S::npos); test(S(""), SV("laenf"), 0, S::npos); @@ -122,7 +122,7 @@ } template -void test1() +TEST_CONSTEXPR_CXX20 void test1() { test(S(""), SV(""), S::npos); test(S(""), SV("laenf"), S::npos); @@ -142,21 +142,30 @@ test(S("pniotcfrhqsmgdkjbael"), SV("htaobedqikfplcgjsmrn"), 0); } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; typedef std::string_view SV; test0(); test1(); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; typedef std::string_view SV; test0(); test1(); - } + } +#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.ops/string_find.last.not.of/char_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_find.last.not.of/char_size.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.ops/string_find.last.not.of/char_size.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.ops/string_find.last.not.of/char_size.pass.cpp @@ -17,7 +17,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(const S& s, typename S::value_type c, typename S::size_type pos, typename S::size_type x) { @@ -28,7 +28,7 @@ } template -void +TEST_CONSTEXPR_CXX20 void test(const S& s, typename S::value_type c, typename S::size_type x) { LIBCPP_ASSERT_NOEXCEPT(s.find_last_not_of(c)); @@ -37,9 +37,8 @@ assert(x < s.size()); } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; test(S(""), 'i', 0, S::npos); test(S(""), 'i', 1, S::npos); @@ -66,9 +65,9 @@ test(S("csope"), 'i', 4); test(S("gfsmthlkon"), 'i', 9); test(S("laenfsbridchgotmkqpj"), 'i', 19); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; test(S(""), 'i', 0, S::npos); test(S(""), 'i', 1, S::npos); @@ -95,7 +94,17 @@ test(S("csope"), 'i', 4); test(S("gfsmthlkon"), 'i', 9); test(S("laenfsbridchgotmkqpj"), 'i', 19); - } + } +#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.ops/string_find.last.not.of/pointer_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_find.last.not.of/pointer_size.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.ops/string_find.last.not.of/pointer_size.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.ops/string_find.last.not.of/pointer_size.pass.cpp @@ -17,7 +17,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(const S& s, const typename S::value_type* str, typename S::size_type pos, typename S::size_type x) { @@ -28,7 +28,7 @@ } template -void +TEST_CONSTEXPR_CXX20 void test(const S& s, const typename S::value_type* str, typename S::size_type x) { LIBCPP_ASSERT_NOEXCEPT(s.find_last_not_of(str)); @@ -38,7 +38,7 @@ } template -void test0() +TEST_CONSTEXPR_CXX20 void test0() { test(S(""), "", 0, S::npos); test(S(""), "laenf", 0, S::npos); @@ -123,7 +123,7 @@ } template -void test1() +TEST_CONSTEXPR_CXX20 void test1() { test(S(""), "", S::npos); test(S(""), "laenf", S::npos); @@ -143,19 +143,28 @@ test(S("pniotcfrhqsmgdkjbael"), "htaobedqikfplcgjsmrn", S::npos); } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; test0(); test1(); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; test0(); test1(); - } + } +#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.ops/string_find.last.not.of/pointer_size_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_find.last.not.of/pointer_size_size.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.ops/string_find.last.not.of/pointer_size_size.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.ops/string_find.last.not.of/pointer_size_size.pass.cpp @@ -17,7 +17,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(const S& s, const typename S::value_type* str, typename S::size_type pos, typename S::size_type n, typename S::size_type x) { @@ -28,7 +28,7 @@ } template -void test0() +TEST_CONSTEXPR_CXX20 void test0() { test(S(""), "", 0, 0, S::npos); test(S(""), "irkhs", 0, 0, S::npos); @@ -133,7 +133,7 @@ } template -void test1() +TEST_CONSTEXPR_CXX20 void test1() { test(S("gbhqo"), "skqne", 5, 4, 4); test(S("ktdor"), "kipnf", 5, 5, 4); @@ -238,7 +238,7 @@ } template -void test2() +TEST_CONSTEXPR_CXX20 void test2() { test(S("sdpcilonqj"), "dnjfsagktr", 10, 5, 8); test(S("gtfbdkqeml"), "nejaktmiqg", 10, 9, 9); @@ -343,7 +343,7 @@ } template -void test3() +TEST_CONSTEXPR_CXX20 void test3() { test(S("pboqganrhedjmltsicfk"), "gbkhdnpoietfcmrslajq", 20, 1, 19); test(S("klchabsimetjnqgorfpd"), "rtfnmbsglkjaichoqedp", 20, 10, 19); @@ -367,23 +367,32 @@ test(S("hnbrcplsjfgiktoedmaq"), "qprlsfojamgndekthibc", 21, 20, S::npos); } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; test0(); test1(); test2(); test3(); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; test0(); test1(); test2(); test3(); - } + } +#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.ops/string_find.last.not.of/string_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_find.last.not.of/string_size.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.ops/string_find.last.not.of/string_size.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.ops/string_find.last.not.of/string_size.pass.cpp @@ -17,7 +17,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(const S& s, const S& str, typename S::size_type pos, typename S::size_type x) { LIBCPP_ASSERT_NOEXCEPT(s.find_last_not_of(str, pos)); @@ -27,7 +27,7 @@ } template -void +TEST_CONSTEXPR_CXX20 void test(const S& s, const S& str, typename S::size_type x) { LIBCPP_ASSERT_NOEXCEPT(s.find_last_not_of(str)); @@ -37,7 +37,7 @@ } template -void test0() +TEST_CONSTEXPR_CXX20 void test0() { test(S(""), S(""), 0, S::npos); test(S(""), S("laenf"), 0, S::npos); @@ -122,7 +122,7 @@ } template -void test1() +TEST_CONSTEXPR_CXX20 void test1() { test(S(""), S(""), S::npos); test(S(""), S("laenf"), S::npos); @@ -142,26 +142,35 @@ test(S("pniotcfrhqsmgdkjbael"), S("htaobedqikfplcgjsmrn"), S::npos); } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; test0(); test1(); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; test0(); test1(); - } + } #endif #if TEST_STD_VER > 3 - { // LWG 2946 + { // LWG 2946 std::string s = " !"; assert(s.find_last_not_of({"abc", 1}) == s.size() - 1); - } + } +#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.ops/string_find.last.not.of/string_view_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_find.last.not.of/string_view_size.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.ops/string_find.last.not.of/string_view_size.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.ops/string_find.last.not.of/string_view_size.pass.cpp @@ -17,7 +17,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(const S& s, SV sv, typename S::size_type pos, typename S::size_type x) { LIBCPP_ASSERT_NOEXCEPT(s.find_last_not_of(sv, pos)); @@ -27,7 +27,7 @@ } template -void +TEST_CONSTEXPR_CXX20 void test(const S& s, SV sv, typename S::size_type x) { LIBCPP_ASSERT_NOEXCEPT(s.find_last_not_of(sv)); @@ -37,7 +37,7 @@ } template -void test0() +TEST_CONSTEXPR_CXX20 void test0() { test(S(""), SV(""), 0, S::npos); test(S(""), SV("laenf"), 0, S::npos); @@ -122,7 +122,7 @@ } template -void test1() +TEST_CONSTEXPR_CXX20 void test1() { test(S(""), SV(""), S::npos); test(S(""), SV("laenf"), S::npos); @@ -142,21 +142,30 @@ test(S("pniotcfrhqsmgdkjbael"), SV("htaobedqikfplcgjsmrn"), S::npos); } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; typedef std::string_view SV; test0(); test1(); - } + } #if TEST_STD_VER >= 11 - { + { // typedef std::basic_string, min_allocator> S; // typedef std::string_view SV; // test0(); // test1(); - } + } +#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.ops/string_find.last.of/char_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_find.last.of/char_size.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.ops/string_find.last.of/char_size.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.ops/string_find.last.of/char_size.pass.cpp @@ -17,7 +17,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(const S& s, typename S::value_type c, typename S::size_type pos, typename S::size_type x) { @@ -28,7 +28,7 @@ } template -void +TEST_CONSTEXPR_CXX20 void test(const S& s, typename S::value_type c, typename S::size_type x) { LIBCPP_ASSERT_NOEXCEPT(s.find_last_of(c)); @@ -37,9 +37,8 @@ assert(x < s.size()); } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; test(S(""), 'm', 0, S::npos); test(S(""), 'm', 1, S::npos); @@ -66,9 +65,9 @@ test(S("csope"), 'm', S::npos); test(S("gfsmthlkon"), 'm', 3); test(S("laenfsbridchgotmkqpj"), 'm', 15); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; test(S(""), 'm', 0, S::npos); test(S(""), 'm', 1, S::npos); @@ -95,7 +94,17 @@ test(S("csope"), 'm', S::npos); test(S("gfsmthlkon"), 'm', 3); test(S("laenfsbridchgotmkqpj"), 'm', 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.ops/string_find.last.of/pointer_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_find.last.of/pointer_size.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.ops/string_find.last.of/pointer_size.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.ops/string_find.last.of/pointer_size.pass.cpp @@ -17,7 +17,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(const S& s, const typename S::value_type* str, typename S::size_type pos, typename S::size_type x) { @@ -28,7 +28,7 @@ } template -void +TEST_CONSTEXPR_CXX20 void test(const S& s, const typename S::value_type* str, typename S::size_type x) { LIBCPP_ASSERT_NOEXCEPT(s.find_last_of(str)); @@ -38,7 +38,7 @@ } template -void test0() +TEST_CONSTEXPR_CXX20 void test0() { test(S(""), "", 0, S::npos); test(S(""), "laenf", 0, S::npos); @@ -123,7 +123,7 @@ } template -void test1() +TEST_CONSTEXPR_CXX20 void test1() { test(S(""), "", S::npos); test(S(""), "laenf", S::npos); @@ -143,19 +143,28 @@ test(S("pniotcfrhqsmgdkjbael"), "htaobedqikfplcgjsmrn", 19); } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; test0(); test1(); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; test0(); test1(); - } + } +#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.ops/string_find.last.of/pointer_size_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_find.last.of/pointer_size_size.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.ops/string_find.last.of/pointer_size_size.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.ops/string_find.last.of/pointer_size_size.pass.cpp @@ -17,7 +17,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(const S& s, const typename S::value_type* str, typename S::size_type pos, typename S::size_type n, typename S::size_type x) { @@ -28,7 +28,7 @@ } template -void test0() +TEST_CONSTEXPR_CXX20 void test0() { test(S(""), "", 0, 0, S::npos); test(S(""), "irkhs", 0, 0, S::npos); @@ -133,7 +133,7 @@ } template -void test1() +TEST_CONSTEXPR_CXX20 void test1() { test(S("gbhqo"), "skqne", 5, 4, 3); test(S("ktdor"), "kipnf", 5, 5, 0); @@ -238,7 +238,7 @@ } template -void test2() +TEST_CONSTEXPR_CXX20 void test2() { test(S("sdpcilonqj"), "dnjfsagktr", 10, 5, 9); test(S("gtfbdkqeml"), "nejaktmiqg", 10, 9, 8); @@ -343,7 +343,7 @@ } template -void test3() +TEST_CONSTEXPR_CXX20 void test3() { test(S("pboqganrhedjmltsicfk"), "gbkhdnpoietfcmrslajq", 20, 1, 4); test(S("klchabsimetjnqgorfpd"), "rtfnmbsglkjaichoqedp", 20, 10, 17); @@ -367,23 +367,32 @@ test(S("hnbrcplsjfgiktoedmaq"), "qprlsfojamgndekthibc", 21, 20, 19); } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; test0(); test1(); test2(); test3(); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; test0(); test1(); test2(); test3(); - } + } +#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.ops/string_find.last.of/string_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_find.last.of/string_size.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.ops/string_find.last.of/string_size.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.ops/string_find.last.of/string_size.pass.cpp @@ -17,7 +17,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(const S& s, const S& str, typename S::size_type pos, typename S::size_type x) { LIBCPP_ASSERT_NOEXCEPT(s.find_last_of(str, pos)); @@ -27,7 +27,7 @@ } template -void +TEST_CONSTEXPR_CXX20 void test(const S& s, const S& str, typename S::size_type x) { LIBCPP_ASSERT_NOEXCEPT(s.find_last_of(str)); @@ -37,7 +37,7 @@ } template -void test0() +TEST_CONSTEXPR_CXX20 void test0() { test(S(""), S(""), 0, S::npos); test(S(""), S("laenf"), 0, S::npos); @@ -122,7 +122,7 @@ } template -void test1() +TEST_CONSTEXPR_CXX20 void test1() { test(S(""), S(""), S::npos); test(S(""), S("laenf"), S::npos); @@ -142,26 +142,35 @@ test(S("pniotcfrhqsmgdkjbael"), S("htaobedqikfplcgjsmrn"), 19); } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; test0(); test1(); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; test0(); test1(); - } + } #endif #if TEST_STD_VER > 3 - { // LWG 2946 + { // LWG 2946 std::string s = " !"; assert(s.find_last_of({"abc", 1}) == std::string::npos); - } + } +#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.ops/string_find.last.of/string_view_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_find.last.of/string_view_size.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.ops/string_find.last.of/string_view_size.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.ops/string_find.last.of/string_view_size.pass.cpp @@ -17,7 +17,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(const S& s, SV sv, typename S::size_type pos, typename S::size_type x) { LIBCPP_ASSERT_NOEXCEPT(s.find_last_of(sv, pos)); @@ -27,7 +27,7 @@ } template -void +TEST_CONSTEXPR_CXX20 void test(const S& s, SV sv, typename S::size_type x) { LIBCPP_ASSERT_NOEXCEPT(s.find_last_of(sv)); @@ -37,7 +37,7 @@ } template -void test0() +TEST_CONSTEXPR_CXX20 void test0() { test(S(""), SV(""), 0, S::npos); test(S(""), SV("laenf"), 0, S::npos); @@ -122,7 +122,7 @@ } template -void test1() +TEST_CONSTEXPR_CXX20 void test1() { test(S(""), SV(""), S::npos); test(S(""), SV("laenf"), S::npos); @@ -142,21 +142,30 @@ test(S("pniotcfrhqsmgdkjbael"), SV("htaobedqikfplcgjsmrn"), 19); } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; typedef std::string_view SV; test0(); test1(); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; typedef std::string_view SV; test0(); test1(); - } + } +#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.ops/string_find/char_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_find/char_size.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.ops/string_find/char_size.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.ops/string_find/char_size.pass.cpp @@ -17,7 +17,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(const S& s, typename S::value_type c, typename S::size_type pos, typename S::size_type x) { @@ -28,7 +28,7 @@ } template -void +TEST_CONSTEXPR_CXX20 void test(const S& s, typename S::value_type c, typename S::size_type x) { LIBCPP_ASSERT_NOEXCEPT(s.find(c)); @@ -37,9 +37,8 @@ assert(0 <= x && x + 1 <= s.size()); } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; test(S(""), 'c', 0, S::npos); test(S(""), 'c', 1, S::npos); @@ -66,9 +65,9 @@ test(S("abcde"), 'c', 2); test(S("abcdeabcde"), 'c', 2); test(S("abcdeabcdeabcdeabcde"), 'c', 2); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; test(S(""), 'c', 0, S::npos); test(S(""), 'c', 1, S::npos); @@ -95,7 +94,17 @@ test(S("abcde"), 'c', 2); test(S("abcdeabcde"), 'c', 2); test(S("abcdeabcdeabcdeabcde"), 'c', 2); - } + } +#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.ops/string_find/pointer_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_find/pointer_size.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.ops/string_find/pointer_size.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.ops/string_find/pointer_size.pass.cpp @@ -17,7 +17,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(const S& s, const typename S::value_type* str, typename S::size_type pos, typename S::size_type x) { @@ -31,7 +31,7 @@ } template -void +TEST_CONSTEXPR_CXX20 void test(const S& s, const typename S::value_type* str, typename S::size_type x) { LIBCPP_ASSERT_NOEXCEPT(s.find(str)); @@ -44,7 +44,7 @@ } template -void test0() +TEST_CONSTEXPR_CXX20 void test0() { test(S(""), "", 0, 0); test(S(""), "abcde", 0, S::npos); @@ -129,7 +129,7 @@ } template -void test1() +TEST_CONSTEXPR_CXX20 void test1() { test(S(""), "", 0); test(S(""), "abcde", S::npos); @@ -149,19 +149,28 @@ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 0); } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; test0(); test1(); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; test0(); test1(); - } + } +#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.ops/string_find/pointer_size_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_find/pointer_size_size.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.ops/string_find/pointer_size_size.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.ops/string_find/pointer_size_size.pass.cpp @@ -28,7 +28,7 @@ } template -void test0() +TEST_CONSTEXPR_CXX20 void test0() { test(S(""), "", 0, 0, 0); test(S(""), "abcde", 0, 0, 0); @@ -133,7 +133,7 @@ } template -void test1() +TEST_CONSTEXPR_CXX20 void test1() { test(S("abcde"), "abcde", 5, 4, S::npos); test(S("abcde"), "abcde", 5, 5, S::npos); @@ -238,7 +238,7 @@ } template -void test2() +TEST_CONSTEXPR_CXX20 void test2() { test(S("abcdeabcde"), "abcdeabcde", 10, 5, S::npos); test(S("abcdeabcde"), "abcdeabcde", 10, 9, S::npos); @@ -343,7 +343,7 @@ } template -void test3() +TEST_CONSTEXPR_CXX20 void test3() { test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 20, 1, S::npos); test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 20, 10, S::npos); @@ -367,23 +367,32 @@ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 21, 20, S::npos); } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; test0(); test1(); test2(); test3(); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; test0(); test1(); test2(); test3(); - } + } +#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.ops/string_find/string_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_find/string_size.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.ops/string_find/string_size.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.ops/string_find/string_size.pass.cpp @@ -17,7 +17,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(const S& s, const S& str, typename S::size_type pos, typename S::size_type x) { LIBCPP_ASSERT_NOEXCEPT(s.find(str, pos)); @@ -27,7 +27,7 @@ } template -void +TEST_CONSTEXPR_CXX20 void test(const S& s, const S& str, typename S::size_type x) { LIBCPP_ASSERT_NOEXCEPT(s.find(str)); @@ -37,7 +37,7 @@ } template -void test0() +TEST_CONSTEXPR_CXX20 void test0() { test(S(""), S(""), 0, 0); test(S(""), S("abcde"), 0, S::npos); @@ -122,7 +122,7 @@ } template -void test1() +TEST_CONSTEXPR_CXX20 void test1() { test(S(""), S(""), 0); test(S(""), S("abcde"), S::npos); @@ -142,26 +142,35 @@ test(S("abcdeabcdeabcdeabcde"), S("abcdeabcdeabcdeabcde"), 0); } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; test0(); test1(); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; test0(); test1(); - } + } #endif #if TEST_STD_VER > 3 - { // LWG 2946 + { // LWG 2946 std::string s = " !"; assert(s.find({"abc", 1}) == std::string::npos); - } + } +#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.ops/string_find/string_view_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_find/string_view_size.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.ops/string_find/string_view_size.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.ops/string_find/string_view_size.pass.cpp @@ -17,7 +17,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(const S& s, SV sv, typename S::size_type pos, typename S::size_type x) { LIBCPP_ASSERT_NOEXCEPT(s.find(sv, pos)); @@ -27,7 +27,7 @@ } template -void +TEST_CONSTEXPR_CXX20 void test(const S& s, SV sv, typename S::size_type x) { LIBCPP_ASSERT_NOEXCEPT(s.find(sv)); @@ -37,7 +37,7 @@ } template -void test0() +TEST_CONSTEXPR_CXX20 void test0() { test(S(""), SV(""), 0, 0); test(S(""), SV("abcde"), 0, S::npos); @@ -122,7 +122,7 @@ } template -void test1() +TEST_CONSTEXPR_CXX20 void test1() { test(S(""), SV(""), 0); test(S(""), SV("abcde"), S::npos); @@ -142,21 +142,30 @@ test(S("abcdeabcdeabcdeabcde"), SV("abcdeabcdeabcdeabcde"), 0); } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; typedef std::string_view SV; test0(); test1(); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; typedef std::string_view SV; test0(); test1(); - } + } +#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.ops/string_rfind/char_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_rfind/char_size.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.ops/string_rfind/char_size.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.ops/string_rfind/char_size.pass.cpp @@ -17,7 +17,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(const S& s, typename S::value_type c, typename S::size_type pos, typename S::size_type x) { @@ -28,7 +28,7 @@ } template -void +TEST_CONSTEXPR_CXX20 void test(const S& s, typename S::value_type c, typename S::size_type x) { LIBCPP_ASSERT_NOEXCEPT(s.rfind(c)); @@ -37,9 +37,8 @@ assert(x + 1 <= s.size()); } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; test(S(""), 'b', 0, S::npos); test(S(""), 'b', 1, S::npos); @@ -66,9 +65,9 @@ test(S("abcde"), 'b', 1); test(S("abcdeabcde"), 'b', 6); test(S("abcdeabcdeabcdeabcde"), 'b', 16); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; test(S(""), 'b', 0, S::npos); test(S(""), 'b', 1, S::npos); @@ -95,7 +94,17 @@ test(S("abcde"), 'b', 1); test(S("abcdeabcde"), 'b', 6); test(S("abcdeabcdeabcdeabcde"), 'b', 16); - } + } +#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.ops/string_rfind/pointer_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_rfind/pointer_size.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.ops/string_rfind/pointer_size.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.ops/string_rfind/pointer_size.pass.cpp @@ -17,7 +17,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(const S& s, const typename S::value_type* str, typename S::size_type pos, typename S::size_type x) { @@ -31,7 +31,7 @@ } template -void +TEST_CONSTEXPR_CXX20 void test(const S& s, const typename S::value_type* str, typename S::size_type x) { LIBCPP_ASSERT_NOEXCEPT(s.rfind(str)); @@ -45,7 +45,7 @@ } template -void test0() +TEST_CONSTEXPR_CXX20 void test0() { test(S(""), "", 0, 0); test(S(""), "abcde", 0, S::npos); @@ -130,7 +130,7 @@ } template -void test1() +TEST_CONSTEXPR_CXX20 void test1() { test(S(""), "", 0); test(S(""), "abcde", S::npos); @@ -150,19 +150,28 @@ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 0); } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; test0(); test1(); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; test0(); test1(); - } + } +#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.ops/string_rfind/pointer_size_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_rfind/pointer_size_size.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.ops/string_rfind/pointer_size_size.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.ops/string_rfind/pointer_size_size.pass.cpp @@ -17,7 +17,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(const S& s, const typename S::value_type* str, typename S::size_type pos, typename S::size_type n, typename S::size_type x) { @@ -28,7 +28,7 @@ } template -void test0() +TEST_CONSTEXPR_CXX20 void test0() { test(S(""), "", 0, 0, 0); test(S(""), "abcde", 0, 0, 0); @@ -133,7 +133,7 @@ } template -void test1() +TEST_CONSTEXPR_CXX20 void test1() { test(S("abcde"), "abcde", 5, 4, 0); test(S("abcde"), "abcde", 5, 5, 0); @@ -238,7 +238,7 @@ } template -void test2() +TEST_CONSTEXPR_CXX20 void test2() { test(S("abcdeabcde"), "abcdeabcde", 10, 5, 5); test(S("abcdeabcde"), "abcdeabcde", 10, 9, 0); @@ -343,7 +343,7 @@ } template -void test3() +TEST_CONSTEXPR_CXX20 void test3() { test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 20, 1, 15); test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 20, 10, 10); @@ -367,23 +367,32 @@ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 21, 20, 0); } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; test0(); test1(); test2(); test3(); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; test0(); test1(); test2(); test3(); - } + } +#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.ops/string_rfind/string_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_rfind/string_size.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.ops/string_rfind/string_size.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.ops/string_rfind/string_size.pass.cpp @@ -17,7 +17,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(const S& s, const S& str, typename S::size_type pos, typename S::size_type x) { LIBCPP_ASSERT_NOEXCEPT(s.rfind(str, pos)); @@ -27,7 +27,7 @@ } template -void +TEST_CONSTEXPR_CXX20 void test(const S& s, const S& str, typename S::size_type x) { LIBCPP_ASSERT_NOEXCEPT(s.rfind(str)); @@ -37,7 +37,7 @@ } template -void test0() +TEST_CONSTEXPR_CXX20 void test0() { test(S(""), S(""), 0, 0); test(S(""), S("abcde"), 0, S::npos); @@ -122,7 +122,7 @@ } template -void test1() +TEST_CONSTEXPR_CXX20 void test1() { test(S(""), S(""), 0); test(S(""), S("abcde"), S::npos); @@ -142,26 +142,35 @@ test(S("abcdeabcdeabcdeabcde"), S("abcdeabcdeabcdeabcde"), 0); } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; test0(); test1(); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; test0(); test1(); - } + } #endif #if TEST_STD_VER > 3 - { // LWG 2946 + { // LWG 2946 std::string s = " !"; assert(s.rfind({"abc", 1}) == std::string::npos); - } + } +#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.ops/string_rfind/string_view_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_rfind/string_view_size.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.ops/string_rfind/string_view_size.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.ops/string_rfind/string_view_size.pass.cpp @@ -17,7 +17,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(const S& s, SV sv, typename S::size_type pos, typename S::size_type x) { LIBCPP_ASSERT_NOEXCEPT(s.rfind(sv, pos)); @@ -27,7 +27,7 @@ } template -void +TEST_CONSTEXPR_CXX20 void test(const S& s, SV sv, typename S::size_type x) { LIBCPP_ASSERT_NOEXCEPT(s.rfind(sv)); @@ -37,7 +37,7 @@ } template -void test0() +TEST_CONSTEXPR_CXX20 void test0() { test(S(""), SV(""), 0, 0); test(S(""), SV("abcde"), 0, S::npos); @@ -122,7 +122,7 @@ } template -void test1() +TEST_CONSTEXPR_CXX20 void test1() { test(S(""), SV(""), 0); test(S(""), SV("abcde"), S::npos); @@ -142,21 +142,30 @@ test(S("abcdeabcdeabcdeabcde"), SV("abcdeabcdeabcdeabcde"), 0); } -int main(int, char**) -{ - { +bool test() { + { typedef std::string S; typedef std::string_view SV; test0(); test1(); - } + } #if TEST_STD_VER >= 11 - { + { typedef std::basic_string, min_allocator> S; typedef std::string_view SV; test0(); test1(); - } + } +#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.ops/string_substr/substr.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_substr/substr.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.ops/string_substr/substr.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.ops/string_substr/substr.pass.cpp @@ -19,7 +19,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test(const S& s, typename S::size_type pos, typename S::size_type n) { if (pos <= s.size()) @@ -47,8 +47,7 @@ #endif } -int main(int, char**) -{ +bool test() { { typedef std::string S; test(S(""), 0, 0); @@ -174,5 +173,15 @@ } #endif + return true; +} + +int main(int, char**) +{ + test(); +#if TEST_STD_VER > 17 + // static_assert(test()); +#endif + return 0; }