aboutsummaryrefslogtreecommitdiff
path: root/test/std/strings/basic.string/string.nonmembers/string_op+/pointer_string.pass.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/std/strings/basic.string/string.nonmembers/string_op+/pointer_string.pass.cpp')
-rw-r--r--test/std/strings/basic.string/string.nonmembers/string_op+/pointer_string.pass.cpp83
1 files changed, 43 insertions, 40 deletions
diff --git a/test/std/strings/basic.string/string.nonmembers/string_op+/pointer_string.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string_op+/pointer_string.pass.cpp
index 88fa678ec44f..090707fd8695 100644
--- a/test/std/strings/basic.string/string.nonmembers/string_op+/pointer_string.pass.cpp
+++ b/test/std/strings/basic.string/string.nonmembers/string_op+/pointer_string.pass.cpp
@@ -21,29 +21,23 @@
#include <utility>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class S>
-void
-test0(const typename S::value_type* lhs, const S& rhs, const S& x)
-{
- assert(lhs + rhs == x);
+void test0(const typename S::value_type* lhs, const S& rhs, const S& x) {
+ assert(lhs + rhs == x);
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
+#if TEST_STD_VER >= 11
template <class S>
-void
-test1(const typename S::value_type* lhs, S&& rhs, const S& x)
-{
- assert(lhs + move(rhs) == x);
+void test1(const typename S::value_type* lhs, S&& rhs, const S& x) {
+ assert(lhs + move(rhs) == x);
}
+#endif
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
-int main()
-{
- {
+int main() {
+ {
typedef std::string S;
test0("", S(""), S(""));
test0("", S("12345"), S("12345"));
@@ -56,14 +50,19 @@ int main()
test0("abcdefghij", S(""), S("abcdefghij"));
test0("abcdefghij", S("12345"), S("abcdefghij12345"));
test0("abcdefghij", S("1234567890"), S("abcdefghij1234567890"));
- test0("abcdefghij", S("12345678901234567890"), S("abcdefghij12345678901234567890"));
+ test0("abcdefghij", S("12345678901234567890"),
+ S("abcdefghij12345678901234567890"));
test0("abcdefghijklmnopqrst", S(""), S("abcdefghijklmnopqrst"));
test0("abcdefghijklmnopqrst", S("12345"), S("abcdefghijklmnopqrst12345"));
- test0("abcdefghijklmnopqrst", S("1234567890"), S("abcdefghijklmnopqrst1234567890"));
- test0("abcdefghijklmnopqrst", S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890"));
-
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ test0("abcdefghijklmnopqrst", S("1234567890"),
+ S("abcdefghijklmnopqrst1234567890"));
+ test0("abcdefghijklmnopqrst", S("12345678901234567890"),
+ S("abcdefghijklmnopqrst12345678901234567890"));
+ }
+#if TEST_STD_VER >= 11
+ {
+ typedef std::string S;
test1("", S(""), S(""));
test1("", S("12345"), S("12345"));
test1("", S("1234567890"), S("1234567890"));
@@ -75,17 +74,19 @@ int main()
test1("abcdefghij", S(""), S("abcdefghij"));
test1("abcdefghij", S("12345"), S("abcdefghij12345"));
test1("abcdefghij", S("1234567890"), S("abcdefghij1234567890"));
- test1("abcdefghij", S("12345678901234567890"), S("abcdefghij12345678901234567890"));
+ test1("abcdefghij", S("12345678901234567890"),
+ S("abcdefghij12345678901234567890"));
test1("abcdefghijklmnopqrst", S(""), S("abcdefghijklmnopqrst"));
test1("abcdefghijklmnopqrst", S("12345"), S("abcdefghijklmnopqrst12345"));
- test1("abcdefghijklmnopqrst", S("1234567890"), S("abcdefghijklmnopqrst1234567890"));
- test1("abcdefghijklmnopqrst", S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890"));
-
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
- }
-#if TEST_STD_VER >= 11
- {
- typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
+ test1("abcdefghijklmnopqrst", S("1234567890"),
+ S("abcdefghijklmnopqrst1234567890"));
+ test1("abcdefghijklmnopqrst", S("12345678901234567890"),
+ S("abcdefghijklmnopqrst12345678901234567890"));
+ }
+ {
+ typedef std::basic_string<char, std::char_traits<char>,
+ min_allocator<char> >
+ S;
test0("", S(""), S(""));
test0("", S("12345"), S("12345"));
test0("", S("1234567890"), S("1234567890"));
@@ -97,13 +98,14 @@ int main()
test0("abcdefghij", S(""), S("abcdefghij"));
test0("abcdefghij", S("12345"), S("abcdefghij12345"));
test0("abcdefghij", S("1234567890"), S("abcdefghij1234567890"));
- test0("abcdefghij", S("12345678901234567890"), S("abcdefghij12345678901234567890"));
+ test0("abcdefghij", S("12345678901234567890"),
+ S("abcdefghij12345678901234567890"));
test0("abcdefghijklmnopqrst", S(""), S("abcdefghijklmnopqrst"));
test0("abcdefghijklmnopqrst", S("12345"), S("abcdefghijklmnopqrst12345"));
- test0("abcdefghijklmnopqrst", S("1234567890"), S("abcdefghijklmnopqrst1234567890"));
- test0("abcdefghijklmnopqrst", S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890"));
-
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ test0("abcdefghijklmnopqrst", S("1234567890"),
+ S("abcdefghijklmnopqrst1234567890"));
+ test0("abcdefghijklmnopqrst", S("12345678901234567890"),
+ S("abcdefghijklmnopqrst12345678901234567890"));
test1("", S(""), S(""));
test1("", S("12345"), S("12345"));
@@ -116,13 +118,14 @@ int main()
test1("abcdefghij", S(""), S("abcdefghij"));
test1("abcdefghij", S("12345"), S("abcdefghij12345"));
test1("abcdefghij", S("1234567890"), S("abcdefghij1234567890"));
- test1("abcdefghij", S("12345678901234567890"), S("abcdefghij12345678901234567890"));
+ test1("abcdefghij", S("12345678901234567890"),
+ S("abcdefghij12345678901234567890"));
test1("abcdefghijklmnopqrst", S(""), S("abcdefghijklmnopqrst"));
test1("abcdefghijklmnopqrst", S("12345"), S("abcdefghijklmnopqrst12345"));
- test1("abcdefghijklmnopqrst", S("1234567890"), S("abcdefghijklmnopqrst1234567890"));
- test1("abcdefghijklmnopqrst", S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890"));
-
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
- }
+ test1("abcdefghijklmnopqrst", S("1234567890"),
+ S("abcdefghijklmnopqrst1234567890"));
+ test1("abcdefghijklmnopqrst", S("12345678901234567890"),
+ S("abcdefghijklmnopqrst12345678901234567890"));
+ }
#endif
}