summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/strings/basic.string/string.ops/string_find.first.of/string_view_size.pass.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx/test/std/strings/basic.string/string.ops/string_find.first.of/string_view_size.pass.cpp')
-rw-r--r--libcxx/test/std/strings/basic.string/string.ops/string_find.first.of/string_view_size.pass.cpp29
1 files changed, 19 insertions, 10 deletions
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
index 7570c33465d4..762c11302f72 100644
--- 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 <class S, class SV>
-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 @@ test(const S& s, SV sv, typename S::size_type pos, typename S::size_type x)
}
template <class S, class SV>
-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 @@ test(const S& s, SV sv, typename S::size_type x)
}
template <class S, class SV>
-void test0()
+TEST_CONSTEXPR_CXX20 void test0()
{
test(S(""), SV(""), 0, S::npos);
test(S(""), SV("laenf"), 0, S::npos);
@@ -122,7 +122,7 @@ void test0()
}
template <class S, class SV>
-void test1()
+TEST_CONSTEXPR_CXX20 void test1()
{
test(S(""), SV(""), S::npos);
test(S(""), SV("laenf"), S::npos);
@@ -142,21 +142,30 @@ void test1()
test(S("pniotcfrhqsmgdkjbael"), SV("htaobedqikfplcgjsmrn"), 0);
}
-int main(int, char**)
-{
- {
+bool test() {
+ {
typedef std::string S;
typedef std::string_view SV;
test0<S, SV>();
test1<S, SV>();
- }
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
typedef std::string_view SV;
test0<S, SV>();
test1<S, SV>();
- }
+ }
+#endif
+
+ return true;
+}
+
+int main(int, char**)
+{
+ test();
+#if TEST_STD_VER > 17
+ // static_assert(test());
#endif
return 0;