summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/strings
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2017-04-19 00:28:44 +0000
committerEric Fiselier <eric@efcs.ca>2017-04-19 00:28:44 +0000
commit414d17c67c1c9ad069d484dd99840a2a6599d3d7 (patch)
tree5eac1deb6d7116fa0dc52670d2fdfa0c515c1866 /libcxx/test/std/strings
parent69154d6e071e01fe6d6745e38e565c9d8d3fe543 (diff)
downloadbcm5719-llvm-414d17c67c1c9ad069d484dd99840a2a6599d3d7.tar.gz
bcm5719-llvm-414d17c67c1c9ad069d484dd99840a2a6599d3d7.zip
Cleanup _LIBCPP_HAS_NO_<c++11-feature> in the string library.
llvm-svn: 300633
Diffstat (limited to 'libcxx/test/std/strings')
-rw-r--r--libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_initializer_list.pass.cpp17
-rw-r--r--libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_initializer_list.pass.cpp6
-rw-r--r--libcxx/test/std/strings/basic.string/string.nonmembers/string.io/get_line_delim_rv.pass.cpp6
-rw-r--r--libcxx/test/std/strings/basic.string/string.nonmembers/string.io/get_line_rv.pass.cpp6
-rw-r--r--libcxx/test/std/strings/basic.string/string.nonmembers/string_op+/char_string.pass.cpp48
-rw-r--r--libcxx/test/std/strings/basic.string/string.nonmembers/string_op+/pointer_string.pass.cpp83
-rw-r--r--libcxx/test/std/strings/basic.string/string.nonmembers/string_op+/string_char.pass.cpp48
-rw-r--r--libcxx/test/std/strings/basic.string/string.nonmembers/string_op+/string_pointer.pass.cpp84
-rw-r--r--libcxx/test/std/strings/basic.string/string.nonmembers/string_op+/string_string.pass.cpp181
9 files changed, 236 insertions, 243 deletions
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_initializer_list.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_initializer_list.pass.cpp
index 2adf846c1e3..c5b7cbf9d97 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_initializer_list.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_initializer_list.pass.cpp
@@ -7,13 +7,12 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <string>
// iterator insert(const_iterator p, initializer_list<charT> il);
-#if _LIBCPP_DEBUG >= 1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
-#endif
#include <string>
#include <cassert>
@@ -22,14 +21,12 @@
int main()
{
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
{
std::string s("123456");
std::string::iterator i = s.insert(s.begin() + 3, {'a', 'b', 'c'});
assert(i - s.begin() == 3);
assert(s == "123abc456");
}
-#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
S s("123456");
@@ -37,14 +34,4 @@ int main()
assert(i - s.begin() == 3);
assert(s == "123abc456");
}
-#endif
-#if _LIBCPP_DEBUG >= 1
- {
- std::string s;
- std::string s2;
- s.insert(s2.begin(), {'a', 'b', 'c'});
- assert(false);
- }
-#endif
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_initializer_list.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_initializer_list.pass.cpp
index b60a58c55e0..2a705ebf442 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_initializer_list.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_initializer_list.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <string>
// basic_string& replace(const_iterator i1, const_iterator i2, initializer_list<charT> il);
@@ -18,19 +20,15 @@
int main()
{
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
{
std::string s("123def456");
s.replace(s.cbegin() + 3, s.cbegin() + 6, {'a', 'b', 'c'});
assert(s == "123abc456");
}
-#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
S s("123def456");
s.replace(s.cbegin() + 3, s.cbegin() + 6, {'a', 'b', 'c'});
assert(s == "123abc456");
}
-#endif
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
diff --git a/libcxx/test/std/strings/basic.string/string.nonmembers/string.io/get_line_delim_rv.pass.cpp b/libcxx/test/std/strings/basic.string/string.nonmembers/string.io/get_line_delim_rv.pass.cpp
index 48d1854808c..5dbfe9d4dbe 100644
--- a/libcxx/test/std/strings/basic.string/string.nonmembers/string.io/get_line_delim_rv.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.nonmembers/string.io/get_line_delim_rv.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <string>
// template<class charT, class traits, class Allocator>
@@ -22,7 +24,6 @@
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
std::string s("initial text");
getline(std::istringstream(" abc* def* ghij"), s, '*');
@@ -33,7 +34,6 @@ int main()
getline(std::wistringstream(L" abc* def* ghij"), s, L'*');
assert(s == L" abc");
}
-#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
S s("initial text");
@@ -46,6 +46,4 @@ int main()
getline(std::wistringstream(L" abc* def* ghij"), s, L'*');
assert(s == L" abc");
}
-#endif
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/libcxx/test/std/strings/basic.string/string.nonmembers/string.io/get_line_rv.pass.cpp b/libcxx/test/std/strings/basic.string/string.nonmembers/string.io/get_line_rv.pass.cpp
index 18c22f915ca..0c1fa820341 100644
--- a/libcxx/test/std/strings/basic.string/string.nonmembers/string.io/get_line_rv.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.nonmembers/string.io/get_line_rv.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <string>
// template<class charT, class traits, class Allocator>
@@ -22,7 +24,6 @@
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
std::string s("initial text");
getline(std::istringstream(" abc\n def\n ghij"), s);
@@ -33,7 +34,6 @@ int main()
getline(std::wistringstream(L" abc\n def\n ghij"), s);
assert(s == L" abc");
}
-#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
S s("initial text");
@@ -46,6 +46,4 @@ int main()
getline(std::wistringstream(L" abc\n def\n ghij"), s);
assert(s == L" abc");
}
-#endif
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/libcxx/test/std/strings/basic.string/string.nonmembers/string_op+/char_string.pass.cpp b/libcxx/test/std/strings/basic.string/string.nonmembers/string_op+/char_string.pass.cpp
index 9a8213e230f..7bf7da8900f 100644
--- a/libcxx/test/std/strings/basic.string/string.nonmembers/string_op+/char_string.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.nonmembers/string_op+/char_string.pass.cpp
@@ -21,60 +21,50 @@
#include <utility>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class S>
-void
-test0(typename S::value_type lhs, const S& rhs, const S& x)
-{
- assert(lhs + rhs == x);
+void test0(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(typename S::value_type lhs, S&& rhs, const S& x)
-{
- assert(lhs + move(rhs) == x);
+void test1(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('a', S(""), S("a"));
test0('a', S("12345"), S("a12345"));
test0('a', S("1234567890"), S("a1234567890"));
test0('a', S("12345678901234567890"), S("a12345678901234567890"));
-
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
+ }
+#if TEST_STD_VER >= 11
+ {
+ typedef std::string S;
test1('a', S(""), S("a"));
test1('a', S("12345"), S("a12345"));
test1('a', S("1234567890"), S("a1234567890"));
test1('a', S("12345678901234567890"), S("a12345678901234567890"));
-
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
- }
-#if TEST_STD_VER >= 11
- {
- typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
+ }
+ {
+ typedef std::basic_string<char, std::char_traits<char>,
+ min_allocator<char> >
+ S;
test0('a', S(""), S("a"));
test0('a', S("12345"), S("a12345"));
test0('a', S("1234567890"), S("a1234567890"));
test0('a', S("12345678901234567890"), S("a12345678901234567890"));
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
test1('a', S(""), S("a"));
test1('a', S("12345"), S("a12345"));
test1('a', S("1234567890"), S("a1234567890"));
test1('a', S("12345678901234567890"), S("a12345678901234567890"));
-
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
- }
+ }
#endif
}
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 88fa678ec44..090707fd869 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
@@ -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
}
diff --git a/libcxx/test/std/strings/basic.string/string.nonmembers/string_op+/string_char.pass.cpp b/libcxx/test/std/strings/basic.string/string.nonmembers/string_op+/string_char.pass.cpp
index b4c2c97043c..9bc3a4d41b3 100644
--- a/libcxx/test/std/strings/basic.string/string.nonmembers/string_op+/string_char.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.nonmembers/string_op+/string_char.pass.cpp
@@ -21,60 +21,50 @@
#include <utility>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class S>
-void
-test0(const S& lhs, typename S::value_type rhs, const S& x)
-{
- assert(lhs + rhs == x);
+void test0(const S& lhs, typename S::value_type rhs, const S& x) {
+ assert(lhs + rhs == x);
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
+#if TEST_STD_VER >= 11
template <class S>
-void
-test1(S&& lhs, typename S::value_type rhs, const S& x)
-{
- assert(move(lhs) + rhs == x);
+void test1(S&& lhs, typename S::value_type rhs, const S& x) {
+ assert(move(lhs) + rhs == x);
}
+#endif
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
-int main()
-{
- {
+int main() {
+ {
typedef std::string S;
test0(S(""), '1', S("1"));
test0(S("abcde"), '1', S("abcde1"));
test0(S("abcdefghij"), '1', S("abcdefghij1"));
test0(S("abcdefghijklmnopqrst"), '1', S("abcdefghijklmnopqrst1"));
-
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
+ }
+#if TEST_STD_VER >= 11
+ {
+ typedef std::string S;
test1(S(""), '1', S("1"));
test1(S("abcde"), '1', S("abcde1"));
test1(S("abcdefghij"), '1', S("abcdefghij1"));
test1(S("abcdefghijklmnopqrst"), '1', S("abcdefghijklmnopqrst1"));
-
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
- }
-#if TEST_STD_VER >= 11
- {
- typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
+ }
+ {
+ typedef std::basic_string<char, std::char_traits<char>,
+ min_allocator<char> >
+ S;
test0(S(""), '1', S("1"));
test0(S("abcde"), '1', S("abcde1"));
test0(S("abcdefghij"), '1', S("abcdefghij1"));
test0(S("abcdefghijklmnopqrst"), '1', S("abcdefghijklmnopqrst1"));
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
test1(S(""), '1', S("1"));
test1(S("abcde"), '1', S("abcde1"));
test1(S("abcdefghij"), '1', S("abcdefghij1"));
test1(S("abcdefghijklmnopqrst"), '1', S("abcdefghijklmnopqrst1"));
-
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
- }
+ }
#endif
}
diff --git a/libcxx/test/std/strings/basic.string/string.nonmembers/string_op+/string_pointer.pass.cpp b/libcxx/test/std/strings/basic.string/string.nonmembers/string_op+/string_pointer.pass.cpp
index 3b669e7d986..a9aa92f37e4 100644
--- a/libcxx/test/std/strings/basic.string/string.nonmembers/string_op+/string_pointer.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.nonmembers/string_op+/string_pointer.pass.cpp
@@ -21,29 +21,23 @@
#include <utility>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class S>
-void
-test0(const S& lhs, const typename S::value_type* rhs, const S& x)
-{
- assert(lhs + rhs == x);
+void test0(const S& lhs, const typename S::value_type* rhs, const S& x) {
+ assert(lhs + rhs == x);
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
+#if TEST_STD_VER >= 11
template <class S>
-void
-test1(S&& lhs, const typename S::value_type* rhs, const S& x)
-{
- assert(move(lhs) + rhs == x);
+void test1(S&& lhs, const typename S::value_type* rhs, const S& x) {
+ assert(move(lhs) + 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,18 @@ int main()
test0(S("abcdefghij"), "", S("abcdefghij"));
test0(S("abcdefghij"), "12345", S("abcdefghij12345"));
test0(S("abcdefghij"), "1234567890", S("abcdefghij1234567890"));
- test0(S("abcdefghij"), "12345678901234567890", S("abcdefghij12345678901234567890"));
+ test0(S("abcdefghij"), "12345678901234567890",
+ S("abcdefghij12345678901234567890"));
test0(S("abcdefghijklmnopqrst"), "", S("abcdefghijklmnopqrst"));
test0(S("abcdefghijklmnopqrst"), "12345", S("abcdefghijklmnopqrst12345"));
- test0(S("abcdefghijklmnopqrst"), "1234567890", S("abcdefghijklmnopqrst1234567890"));
- test0(S("abcdefghijklmnopqrst"), "12345678901234567890", S("abcdefghijklmnopqrst12345678901234567890"));
-
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
+ test0(S("abcdefghijklmnopqrst"), "1234567890",
+ S("abcdefghijklmnopqrst1234567890"));
+ test0(S("abcdefghijklmnopqrst"), "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 +73,19 @@ int main()
test1(S("abcdefghij"), "", S("abcdefghij"));
test1(S("abcdefghij"), "12345", S("abcdefghij12345"));
test1(S("abcdefghij"), "1234567890", S("abcdefghij1234567890"));
- test1(S("abcdefghij"), "12345678901234567890", S("abcdefghij12345678901234567890"));
+ test1(S("abcdefghij"), "12345678901234567890",
+ S("abcdefghij12345678901234567890"));
test1(S("abcdefghijklmnopqrst"), "", S("abcdefghijklmnopqrst"));
test1(S("abcdefghijklmnopqrst"), "12345", S("abcdefghijklmnopqrst12345"));
- test1(S("abcdefghijklmnopqrst"), "1234567890", S("abcdefghijklmnopqrst1234567890"));
- test1(S("abcdefghijklmnopqrst"), "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(S("abcdefghijklmnopqrst"), "1234567890",
+ S("abcdefghijklmnopqrst1234567890"));
+ test1(S("abcdefghijklmnopqrst"), "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 +97,14 @@ int main()
test0(S("abcdefghij"), "", S("abcdefghij"));
test0(S("abcdefghij"), "12345", S("abcdefghij12345"));
test0(S("abcdefghij"), "1234567890", S("abcdefghij1234567890"));
- test0(S("abcdefghij"), "12345678901234567890", S("abcdefghij12345678901234567890"));
+ test0(S("abcdefghij"), "12345678901234567890",
+ S("abcdefghij12345678901234567890"));
test0(S("abcdefghijklmnopqrst"), "", S("abcdefghijklmnopqrst"));
test0(S("abcdefghijklmnopqrst"), "12345", S("abcdefghijklmnopqrst12345"));
- test0(S("abcdefghijklmnopqrst"), "1234567890", S("abcdefghijklmnopqrst1234567890"));
- test0(S("abcdefghijklmnopqrst"), "12345678901234567890", S("abcdefghijklmnopqrst12345678901234567890"));
-
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ test0(S("abcdefghijklmnopqrst"), "1234567890",
+ S("abcdefghijklmnopqrst1234567890"));
+ test0(S("abcdefghijklmnopqrst"), "12345678901234567890",
+ S("abcdefghijklmnopqrst12345678901234567890"));
test1(S(""), "", S(""));
test1(S(""), "12345", S("12345"));
@@ -116,13 +117,14 @@ int main()
test1(S("abcdefghij"), "", S("abcdefghij"));
test1(S("abcdefghij"), "12345", S("abcdefghij12345"));
test1(S("abcdefghij"), "1234567890", S("abcdefghij1234567890"));
- test1(S("abcdefghij"), "12345678901234567890", S("abcdefghij12345678901234567890"));
+ test1(S("abcdefghij"), "12345678901234567890",
+ S("abcdefghij12345678901234567890"));
test1(S("abcdefghijklmnopqrst"), "", S("abcdefghijklmnopqrst"));
test1(S("abcdefghijklmnopqrst"), "12345", S("abcdefghijklmnopqrst12345"));
- test1(S("abcdefghijklmnopqrst"), "1234567890", S("abcdefghijklmnopqrst1234567890"));
- test1(S("abcdefghijklmnopqrst"), "12345678901234567890", S("abcdefghijklmnopqrst12345678901234567890"));
-
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
- }
+ test1(S("abcdefghijklmnopqrst"), "1234567890",
+ S("abcdefghijklmnopqrst1234567890"));
+ test1(S("abcdefghijklmnopqrst"), "12345678901234567890",
+ S("abcdefghijklmnopqrst12345678901234567890"));
+ }
#endif
}
diff --git a/libcxx/test/std/strings/basic.string/string.nonmembers/string_op+/string_string.pass.cpp b/libcxx/test/std/strings/basic.string/string.nonmembers/string_op+/string_string.pass.cpp
index 1977b6f517b..fbef6462734 100644
--- a/libcxx/test/std/strings/basic.string/string.nonmembers/string_op+/string_string.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.nonmembers/string_op+/string_string.pass.cpp
@@ -33,43 +33,34 @@
#include <utility>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class S>
-void
-test0(const S& lhs, const S& rhs, const S& x)
-{
- assert(lhs + rhs == x);
+void test0(const S& 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(S&& lhs, const S& rhs, const S& x)
-{
- assert(move(lhs) + rhs == x);
+void test1(S&& lhs, const S& rhs, const S& x) {
+ assert(move(lhs) + rhs == x);
}
template <class S>
-void
-test2(const S& lhs, S&& rhs, const S& x)
-{
- assert(lhs + move(rhs) == x);
+void test2(const S& lhs, S&& rhs, const S& x) {
+ assert(lhs + move(rhs) == x);
}
template <class S>
-void
-test3(S&& lhs, S&& rhs, const S& x)
-{
- assert(move(lhs) + move(rhs) == x);
+void test3(S&& lhs, S&& rhs, const S& x) {
+ assert(move(lhs) + move(rhs) == x);
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif
-int main()
-{
- {
+int main() {
+ {
typedef std::string S;
test0(S(""), S(""), S(""));
test0(S(""), S("12345"), S("12345"));
@@ -78,18 +69,24 @@ int main()
test0(S("abcde"), S(""), S("abcde"));
test0(S("abcde"), S("12345"), S("abcde12345"));
test0(S("abcde"), S("1234567890"), S("abcde1234567890"));
- test0(S("abcde"), S("12345678901234567890"), S("abcde12345678901234567890"));
+ test0(S("abcde"), S("12345678901234567890"),
+ S("abcde12345678901234567890"));
test0(S("abcdefghij"), S(""), S("abcdefghij"));
test0(S("abcdefghij"), S("12345"), S("abcdefghij12345"));
test0(S("abcdefghij"), S("1234567890"), S("abcdefghij1234567890"));
- test0(S("abcdefghij"), S("12345678901234567890"), S("abcdefghij12345678901234567890"));
+ test0(S("abcdefghij"), S("12345678901234567890"),
+ S("abcdefghij12345678901234567890"));
test0(S("abcdefghijklmnopqrst"), S(""), S("abcdefghijklmnopqrst"));
- test0(S("abcdefghijklmnopqrst"), S("12345"), S("abcdefghijklmnopqrst12345"));
- test0(S("abcdefghijklmnopqrst"), S("1234567890"), S("abcdefghijklmnopqrst1234567890"));
- test0(S("abcdefghijklmnopqrst"), S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890"));
-
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
+ test0(S("abcdefghijklmnopqrst"), S("12345"),
+ S("abcdefghijklmnopqrst12345"));
+ test0(S("abcdefghijklmnopqrst"), S("1234567890"),
+ S("abcdefghijklmnopqrst1234567890"));
+ test0(S("abcdefghijklmnopqrst"), S("12345678901234567890"),
+ S("abcdefghijklmnopqrst12345678901234567890"));
+ }
+#if TEST_STD_VER >= 11
+ {
+ typedef std::string S;
test1(S(""), S(""), S(""));
test1(S(""), S("12345"), S("12345"));
test1(S(""), S("1234567890"), S("1234567890"));
@@ -97,15 +94,20 @@ int main()
test1(S("abcde"), S(""), S("abcde"));
test1(S("abcde"), S("12345"), S("abcde12345"));
test1(S("abcde"), S("1234567890"), S("abcde1234567890"));
- test1(S("abcde"), S("12345678901234567890"), S("abcde12345678901234567890"));
+ test1(S("abcde"), S("12345678901234567890"),
+ S("abcde12345678901234567890"));
test1(S("abcdefghij"), S(""), S("abcdefghij"));
test1(S("abcdefghij"), S("12345"), S("abcdefghij12345"));
test1(S("abcdefghij"), S("1234567890"), S("abcdefghij1234567890"));
- test1(S("abcdefghij"), S("12345678901234567890"), S("abcdefghij12345678901234567890"));
+ test1(S("abcdefghij"), S("12345678901234567890"),
+ S("abcdefghij12345678901234567890"));
test1(S("abcdefghijklmnopqrst"), S(""), S("abcdefghijklmnopqrst"));
- test1(S("abcdefghijklmnopqrst"), S("12345"), S("abcdefghijklmnopqrst12345"));
- test1(S("abcdefghijklmnopqrst"), S("1234567890"), S("abcdefghijklmnopqrst1234567890"));
- test1(S("abcdefghijklmnopqrst"), S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890"));
+ test1(S("abcdefghijklmnopqrst"), S("12345"),
+ S("abcdefghijklmnopqrst12345"));
+ test1(S("abcdefghijklmnopqrst"), S("1234567890"),
+ S("abcdefghijklmnopqrst1234567890"));
+ test1(S("abcdefghijklmnopqrst"), S("12345678901234567890"),
+ S("abcdefghijklmnopqrst12345678901234567890"));
test2(S(""), S(""), S(""));
test2(S(""), S("12345"), S("12345"));
@@ -114,15 +116,20 @@ int main()
test2(S("abcde"), S(""), S("abcde"));
test2(S("abcde"), S("12345"), S("abcde12345"));
test2(S("abcde"), S("1234567890"), S("abcde1234567890"));
- test2(S("abcde"), S("12345678901234567890"), S("abcde12345678901234567890"));
+ test2(S("abcde"), S("12345678901234567890"),
+ S("abcde12345678901234567890"));
test2(S("abcdefghij"), S(""), S("abcdefghij"));
test2(S("abcdefghij"), S("12345"), S("abcdefghij12345"));
test2(S("abcdefghij"), S("1234567890"), S("abcdefghij1234567890"));
- test2(S("abcdefghij"), S("12345678901234567890"), S("abcdefghij12345678901234567890"));
+ test2(S("abcdefghij"), S("12345678901234567890"),
+ S("abcdefghij12345678901234567890"));
test2(S("abcdefghijklmnopqrst"), S(""), S("abcdefghijklmnopqrst"));
- test2(S("abcdefghijklmnopqrst"), S("12345"), S("abcdefghijklmnopqrst12345"));
- test2(S("abcdefghijklmnopqrst"), S("1234567890"), S("abcdefghijklmnopqrst1234567890"));
- test2(S("abcdefghijklmnopqrst"), S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890"));
+ test2(S("abcdefghijklmnopqrst"), S("12345"),
+ S("abcdefghijklmnopqrst12345"));
+ test2(S("abcdefghijklmnopqrst"), S("1234567890"),
+ S("abcdefghijklmnopqrst1234567890"));
+ test2(S("abcdefghijklmnopqrst"), S("12345678901234567890"),
+ S("abcdefghijklmnopqrst12345678901234567890"));
test3(S(""), S(""), S(""));
test3(S(""), S("12345"), S("12345"));
@@ -131,21 +138,25 @@ int main()
test3(S("abcde"), S(""), S("abcde"));
test3(S("abcde"), S("12345"), S("abcde12345"));
test3(S("abcde"), S("1234567890"), S("abcde1234567890"));
- test3(S("abcde"), S("12345678901234567890"), S("abcde12345678901234567890"));
+ test3(S("abcde"), S("12345678901234567890"),
+ S("abcde12345678901234567890"));
test3(S("abcdefghij"), S(""), S("abcdefghij"));
test3(S("abcdefghij"), S("12345"), S("abcdefghij12345"));
test3(S("abcdefghij"), S("1234567890"), S("abcdefghij1234567890"));
- test3(S("abcdefghij"), S("12345678901234567890"), S("abcdefghij12345678901234567890"));
+ test3(S("abcdefghij"), S("12345678901234567890"),
+ S("abcdefghij12345678901234567890"));
test3(S("abcdefghijklmnopqrst"), S(""), S("abcdefghijklmnopqrst"));
- test3(S("abcdefghijklmnopqrst"), S("12345"), S("abcdefghijklmnopqrst12345"));
- test3(S("abcdefghijklmnopqrst"), S("1234567890"), S("abcdefghijklmnopqrst1234567890"));
- test3(S("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;
+ test3(S("abcdefghijklmnopqrst"), S("12345"),
+ S("abcdefghijklmnopqrst12345"));
+ test3(S("abcdefghijklmnopqrst"), S("1234567890"),
+ S("abcdefghijklmnopqrst1234567890"));
+ test3(S("abcdefghijklmnopqrst"), S("12345678901234567890"),
+ S("abcdefghijklmnopqrst12345678901234567890"));
+ }
+ {
+ typedef std::basic_string<char, std::char_traits<char>,
+ min_allocator<char> >
+ S;
test0(S(""), S(""), S(""));
test0(S(""), S("12345"), S("12345"));
test0(S(""), S("1234567890"), S("1234567890"));
@@ -153,17 +164,20 @@ int main()
test0(S("abcde"), S(""), S("abcde"));
test0(S("abcde"), S("12345"), S("abcde12345"));
test0(S("abcde"), S("1234567890"), S("abcde1234567890"));
- test0(S("abcde"), S("12345678901234567890"), S("abcde12345678901234567890"));
+ test0(S("abcde"), S("12345678901234567890"),
+ S("abcde12345678901234567890"));
test0(S("abcdefghij"), S(""), S("abcdefghij"));
test0(S("abcdefghij"), S("12345"), S("abcdefghij12345"));
test0(S("abcdefghij"), S("1234567890"), S("abcdefghij1234567890"));
- test0(S("abcdefghij"), S("12345678901234567890"), S("abcdefghij12345678901234567890"));
+ test0(S("abcdefghij"), S("12345678901234567890"),
+ S("abcdefghij12345678901234567890"));
test0(S("abcdefghijklmnopqrst"), S(""), S("abcdefghijklmnopqrst"));
- test0(S("abcdefghijklmnopqrst"), S("12345"), S("abcdefghijklmnopqrst12345"));
- test0(S("abcdefghijklmnopqrst"), S("1234567890"), S("abcdefghijklmnopqrst1234567890"));
- test0(S("abcdefghijklmnopqrst"), S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890"));
-
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ test0(S("abcdefghijklmnopqrst"), S("12345"),
+ S("abcdefghijklmnopqrst12345"));
+ test0(S("abcdefghijklmnopqrst"), S("1234567890"),
+ S("abcdefghijklmnopqrst1234567890"));
+ test0(S("abcdefghijklmnopqrst"), S("12345678901234567890"),
+ S("abcdefghijklmnopqrst12345678901234567890"));
test1(S(""), S(""), S(""));
test1(S(""), S("12345"), S("12345"));
@@ -172,15 +186,20 @@ int main()
test1(S("abcde"), S(""), S("abcde"));
test1(S("abcde"), S("12345"), S("abcde12345"));
test1(S("abcde"), S("1234567890"), S("abcde1234567890"));
- test1(S("abcde"), S("12345678901234567890"), S("abcde12345678901234567890"));
+ test1(S("abcde"), S("12345678901234567890"),
+ S("abcde12345678901234567890"));
test1(S("abcdefghij"), S(""), S("abcdefghij"));
test1(S("abcdefghij"), S("12345"), S("abcdefghij12345"));
test1(S("abcdefghij"), S("1234567890"), S("abcdefghij1234567890"));
- test1(S("abcdefghij"), S("12345678901234567890"), S("abcdefghij12345678901234567890"));
+ test1(S("abcdefghij"), S("12345678901234567890"),
+ S("abcdefghij12345678901234567890"));
test1(S("abcdefghijklmnopqrst"), S(""), S("abcdefghijklmnopqrst"));
- test1(S("abcdefghijklmnopqrst"), S("12345"), S("abcdefghijklmnopqrst12345"));
- test1(S("abcdefghijklmnopqrst"), S("1234567890"), S("abcdefghijklmnopqrst1234567890"));
- test1(S("abcdefghijklmnopqrst"), S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890"));
+ test1(S("abcdefghijklmnopqrst"), S("12345"),
+ S("abcdefghijklmnopqrst12345"));
+ test1(S("abcdefghijklmnopqrst"), S("1234567890"),
+ S("abcdefghijklmnopqrst1234567890"));
+ test1(S("abcdefghijklmnopqrst"), S("12345678901234567890"),
+ S("abcdefghijklmnopqrst12345678901234567890"));
test2(S(""), S(""), S(""));
test2(S(""), S("12345"), S("12345"));
@@ -189,15 +208,20 @@ int main()
test2(S("abcde"), S(""), S("abcde"));
test2(S("abcde"), S("12345"), S("abcde12345"));
test2(S("abcde"), S("1234567890"), S("abcde1234567890"));
- test2(S("abcde"), S("12345678901234567890"), S("abcde12345678901234567890"));
+ test2(S("abcde"), S("12345678901234567890"),
+ S("abcde12345678901234567890"));
test2(S("abcdefghij"), S(""), S("abcdefghij"));
test2(S("abcdefghij"), S("12345"), S("abcdefghij12345"));
test2(S("abcdefghij"), S("1234567890"), S("abcdefghij1234567890"));
- test2(S("abcdefghij"), S("12345678901234567890"), S("abcdefghij12345678901234567890"));
+ test2(S("abcdefghij"), S("12345678901234567890"),
+ S("abcdefghij12345678901234567890"));
test2(S("abcdefghijklmnopqrst"), S(""), S("abcdefghijklmnopqrst"));
- test2(S("abcdefghijklmnopqrst"), S("12345"), S("abcdefghijklmnopqrst12345"));
- test2(S("abcdefghijklmnopqrst"), S("1234567890"), S("abcdefghijklmnopqrst1234567890"));
- test2(S("abcdefghijklmnopqrst"), S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890"));
+ test2(S("abcdefghijklmnopqrst"), S("12345"),
+ S("abcdefghijklmnopqrst12345"));
+ test2(S("abcdefghijklmnopqrst"), S("1234567890"),
+ S("abcdefghijklmnopqrst1234567890"));
+ test2(S("abcdefghijklmnopqrst"), S("12345678901234567890"),
+ S("abcdefghijklmnopqrst12345678901234567890"));
test3(S(""), S(""), S(""));
test3(S(""), S("12345"), S("12345"));
@@ -206,17 +230,20 @@ int main()
test3(S("abcde"), S(""), S("abcde"));
test3(S("abcde"), S("12345"), S("abcde12345"));
test3(S("abcde"), S("1234567890"), S("abcde1234567890"));
- test3(S("abcde"), S("12345678901234567890"), S("abcde12345678901234567890"));
+ test3(S("abcde"), S("12345678901234567890"),
+ S("abcde12345678901234567890"));
test3(S("abcdefghij"), S(""), S("abcdefghij"));
test3(S("abcdefghij"), S("12345"), S("abcdefghij12345"));
test3(S("abcdefghij"), S("1234567890"), S("abcdefghij1234567890"));
- test3(S("abcdefghij"), S("12345678901234567890"), S("abcdefghij12345678901234567890"));
+ test3(S("abcdefghij"), S("12345678901234567890"),
+ S("abcdefghij12345678901234567890"));
test3(S("abcdefghijklmnopqrst"), S(""), S("abcdefghijklmnopqrst"));
- test3(S("abcdefghijklmnopqrst"), S("12345"), S("abcdefghijklmnopqrst12345"));
- test3(S("abcdefghijklmnopqrst"), S("1234567890"), S("abcdefghijklmnopqrst1234567890"));
- test3(S("abcdefghijklmnopqrst"), S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890"));
-
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
- }
-#endif
+ test3(S("abcdefghijklmnopqrst"), S("12345"),
+ S("abcdefghijklmnopqrst12345"));
+ test3(S("abcdefghijklmnopqrst"), S("1234567890"),
+ S("abcdefghijklmnopqrst1234567890"));
+ test3(S("abcdefghijklmnopqrst"), S("12345678901234567890"),
+ S("abcdefghijklmnopqrst12345678901234567890"));
+ }
+#endif // TEST_STD_VER >= 11
}
OpenPOWER on IntegriCloud