summaryrefslogtreecommitdiff
path: root/libcxx/test/std/strings/basic.string/string.nonmembers/string_op!=/pointer_string.pass.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx/test/std/strings/basic.string/string.nonmembers/string_op!=/pointer_string.pass.cpp')
-rw-r--r--libcxx/test/std/strings/basic.string/string.nonmembers/string_op!=/pointer_string.pass.cpp60
1 files changed, 22 insertions, 38 deletions
diff --git a/libcxx/test/std/strings/basic.string/string.nonmembers/string_op!=/pointer_string.pass.cpp b/libcxx/test/std/strings/basic.string/string.nonmembers/string_op!=/pointer_string.pass.cpp
index edc218c9915d..bb1580d4f10f 100644
--- a/libcxx/test/std/strings/basic.string/string.nonmembers/string_op!=/pointer_string.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.nonmembers/string_op!=/pointer_string.pass.cpp
@@ -24,46 +24,30 @@ test(const typename S::value_type* lhs, const S& rhs, bool x)
assert((lhs != rhs) == x);
}
+template <class S>
+TEST_CONSTEXPR_CXX20 void test_string() {
+ test("", S(""), false);
+ test("", S("abcde"), true);
+ test("", S("abcdefghij"), true);
+ test("", S("abcdefghijklmnopqrst"), true);
+ test("abcde", S(""), true);
+ test("abcde", S("abcde"), false);
+ test("abcde", S("abcdefghij"), true);
+ test("abcde", S("abcdefghijklmnopqrst"), true);
+ test("abcdefghij", S(""), true);
+ test("abcdefghij", S("abcde"), true);
+ test("abcdefghij", S("abcdefghij"), false);
+ test("abcdefghij", S("abcdefghijklmnopqrst"), true);
+ test("abcdefghijklmnopqrst", S(""), true);
+ test("abcdefghijklmnopqrst", S("abcde"), true);
+ test("abcdefghijklmnopqrst", S("abcdefghij"), true);
+ test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), false);
+}
+
TEST_CONSTEXPR_CXX20 bool test() {
- {
- typedef std::string S;
- test("", S(""), false);
- test("", S("abcde"), true);
- test("", S("abcdefghij"), true);
- test("", S("abcdefghijklmnopqrst"), true);
- test("abcde", S(""), true);
- test("abcde", S("abcde"), false);
- test("abcde", S("abcdefghij"), true);
- test("abcde", S("abcdefghijklmnopqrst"), true);
- test("abcdefghij", S(""), true);
- test("abcdefghij", S("abcde"), true);
- test("abcdefghij", S("abcdefghij"), false);
- test("abcdefghij", S("abcdefghijklmnopqrst"), true);
- test("abcdefghijklmnopqrst", S(""), true);
- test("abcdefghijklmnopqrst", S("abcde"), true);
- test("abcdefghijklmnopqrst", S("abcdefghij"), true);
- test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), false);
- }
+ test_string<std::string>();
#if TEST_STD_VER >= 11
- {
- typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
- test("", S(""), false);
- test("", S("abcde"), true);
- test("", S("abcdefghij"), true);
- test("", S("abcdefghijklmnopqrst"), true);
- test("abcde", S(""), true);
- test("abcde", S("abcde"), false);
- test("abcde", S("abcdefghij"), true);
- test("abcde", S("abcdefghijklmnopqrst"), true);
- test("abcdefghij", S(""), true);
- test("abcdefghij", S("abcde"), true);
- test("abcdefghij", S("abcdefghij"), false);
- test("abcdefghij", S("abcdefghijklmnopqrst"), true);
- test("abcdefghijklmnopqrst", S(""), true);
- test("abcdefghijklmnopqrst", S("abcde"), true);
- test("abcdefghijklmnopqrst", S("abcdefghij"), true);
- test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), false);
- }
+ test_string<std::basic_string<char, std::char_traits<char>, min_allocator<char>>>();
#endif
return true;