Revert "Merge to upstream r304942."
This reverts commit83b1388ecd, reversing changes made tof20819f925. Test: treehugger Bug: None
This commit is contained in:
@@ -8,12 +8,6 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// UNSUPPORTED: libcpp-no-exceptions
|
||||
// XFAIL: with_system_cxx_lib=macosx10.11
|
||||
// XFAIL: with_system_cxx_lib=macosx10.10
|
||||
// XFAIL: with_system_cxx_lib=macosx10.9
|
||||
// XFAIL: with_system_cxx_lib=macosx10.8
|
||||
// XFAIL: with_system_cxx_lib=macosx10.7
|
||||
|
||||
// <string>
|
||||
|
||||
// size_type max_size() const;
|
||||
|
||||
@@ -27,17 +27,16 @@
|
||||
|
||||
template <class S, class SV>
|
||||
void
|
||||
test(SV sv, std::size_t pos, std::size_t n)
|
||||
test(SV sv, unsigned pos, unsigned n)
|
||||
{
|
||||
typedef typename S::traits_type T;
|
||||
typedef typename S::allocator_type A;
|
||||
typedef typename S::size_type Size;
|
||||
if (pos <= sv.size())
|
||||
{
|
||||
S s2(sv, static_cast<Size>(pos), static_cast<Size>(n));
|
||||
S s2(sv, pos, n);
|
||||
LIBCPP_ASSERT(s2.__invariants());
|
||||
assert(pos <= sv.size());
|
||||
std::size_t rlen = std::min(sv.size() - pos, n);
|
||||
unsigned rlen = std::min<unsigned>(sv.size() - pos, n);
|
||||
assert(s2.size() == rlen);
|
||||
assert(T::compare(s2.data(), sv.data() + pos, rlen) == 0);
|
||||
assert(s2.get_allocator() == A());
|
||||
@@ -48,7 +47,7 @@ test(SV sv, std::size_t pos, std::size_t n)
|
||||
{
|
||||
try
|
||||
{
|
||||
S s2(sv, static_cast<Size>(pos), static_cast<Size>(n));
|
||||
S s2(sv, pos, n);
|
||||
assert(false);
|
||||
}
|
||||
catch (std::out_of_range&)
|
||||
@@ -61,16 +60,16 @@ test(SV sv, std::size_t pos, std::size_t n)
|
||||
|
||||
template <class S, class SV>
|
||||
void
|
||||
test(SV sv, std::size_t pos, std::size_t n, const typename S::allocator_type& a)
|
||||
test(SV sv, unsigned pos, unsigned n, const typename S::allocator_type& a)
|
||||
{
|
||||
typedef typename S::traits_type T;
|
||||
typedef typename S::size_type Size;
|
||||
typedef typename S::allocator_type A;
|
||||
if (pos <= sv.size())
|
||||
{
|
||||
S s2(sv, static_cast<Size>(pos), static_cast<Size>(n), a);
|
||||
S s2(sv, pos, n, a);
|
||||
LIBCPP_ASSERT(s2.__invariants());
|
||||
assert(pos <= sv.size());
|
||||
std::size_t rlen = std::min(sv.size() - pos, n);
|
||||
unsigned rlen = std::min<unsigned>(sv.size() - pos, n);
|
||||
assert(s2.size() == rlen);
|
||||
assert(T::compare(s2.data(), sv.data() + pos, rlen) == 0);
|
||||
assert(s2.get_allocator() == a);
|
||||
@@ -81,7 +80,7 @@ test(SV sv, std::size_t pos, std::size_t n, const typename S::allocator_type& a)
|
||||
{
|
||||
try
|
||||
{
|
||||
S s2(sv, static_cast<Size>(pos), static_cast<Size>(n), a);
|
||||
S s2(sv, pos, n, a);
|
||||
assert(false);
|
||||
}
|
||||
catch (std::out_of_range&)
|
||||
|
||||
@@ -204,20 +204,4 @@ int main()
|
||||
assert(s == "ABCD");
|
||||
}
|
||||
|
||||
{ // test with a move iterator that returns char&&
|
||||
typedef forward_iterator<const char*> It;
|
||||
typedef std::move_iterator<It> MoveIt;
|
||||
const char p[] = "ABCD";
|
||||
std::string s;
|
||||
s.append(MoveIt(It(std::begin(p))), MoveIt(It(std::end(p) - 1)));
|
||||
assert(s == "ABCD");
|
||||
}
|
||||
{ // test with a move iterator that returns char&&
|
||||
typedef const char* It;
|
||||
typedef std::move_iterator<It> MoveIt;
|
||||
const char p[] = "ABCD";
|
||||
std::string s;
|
||||
s.append(MoveIt(It(std::begin(p))), MoveIt(It(std::end(p) - 1)));
|
||||
assert(s == "ABCD");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@ test(S s, typename S::difference_type pos, S expected)
|
||||
typename S::const_iterator p = s.begin() + pos;
|
||||
typename S::iterator i = s.erase(p);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s[s.size()] == typename S::value_type());
|
||||
assert(s == expected);
|
||||
assert(i - s.begin() == pos);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@ test(S s, typename S::difference_type pos, typename S::difference_type n, S expe
|
||||
typename S::const_iterator last = s.cbegin() + pos + n;
|
||||
typename S::iterator i = s.erase(first, last);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s[s.size()] == typename S::value_type());
|
||||
assert(s == expected);
|
||||
assert(i - s.begin() == pos);
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@ test(S s, S expected)
|
||||
{
|
||||
s.pop_back();
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s[s.size()] == typename S::value_type());
|
||||
assert(s == expected);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,6 @@ test(S s, typename S::size_type pos, typename S::size_type n, S expected)
|
||||
{
|
||||
s.erase(pos, n);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s[s.size()] == typename S::value_type());
|
||||
assert(s == expected);
|
||||
}
|
||||
#ifndef TEST_HAS_NO_EXCEPTIONS
|
||||
@@ -59,7 +58,6 @@ test(S s, typename S::size_type pos, S expected)
|
||||
{
|
||||
s.erase(pos);
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s[s.size()] == typename S::value_type());
|
||||
assert(s == expected);
|
||||
}
|
||||
#ifndef TEST_HAS_NO_EXCEPTIONS
|
||||
@@ -85,7 +83,6 @@ test(S s, S expected)
|
||||
{
|
||||
s.erase();
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s[s.size()] == typename S::value_type());
|
||||
assert(s == expected);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,12 +7,13 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// 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>
|
||||
@@ -21,12 +22,14 @@
|
||||
|
||||
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");
|
||||
@@ -34,4 +37,14 @@ 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
|
||||
}
|
||||
|
||||
@@ -188,35 +188,10 @@ int main()
|
||||
|
||||
{ // test assigning a different type
|
||||
typedef std::string S;
|
||||
const uint8_t p[] = "ABCD";
|
||||
const uint8_t p[] = "ABCD";
|
||||
|
||||
S s;
|
||||
s.insert(s.begin(), p, p + 4);
|
||||
assert(s == "ABCD");
|
||||
S s;
|
||||
s.insert(s.begin(), p, p + 4);
|
||||
assert(s == "ABCD");
|
||||
}
|
||||
|
||||
{ // test with a move iterator that returns char&&
|
||||
typedef input_iterator<const char*> It;
|
||||
typedef std::move_iterator<It> MoveIt;
|
||||
const char p[] = "ABCD";
|
||||
std::string s;
|
||||
s.insert(s.begin(), MoveIt(It(std::begin(p))), MoveIt(It(std::end(p) - 1)));
|
||||
assert(s == "ABCD");
|
||||
}
|
||||
{ // test with a move iterator that returns char&&
|
||||
typedef forward_iterator<const char*> It;
|
||||
typedef std::move_iterator<It> MoveIt;
|
||||
const char p[] = "ABCD";
|
||||
std::string s;
|
||||
s.insert(s.begin(), MoveIt(It(std::begin(p))), MoveIt(It(std::end(p) - 1)));
|
||||
assert(s == "ABCD");
|
||||
}
|
||||
{ // test with a move iterator that returns char&&
|
||||
typedef const char* It;
|
||||
typedef std::move_iterator<It> MoveIt;
|
||||
const char p[] = "ABCD";
|
||||
std::string s;
|
||||
s.insert(s.begin(), MoveIt(It(std::begin(p))), MoveIt(It(std::end(p) - 1)));
|
||||
assert(s == "ABCD");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// UNSUPPORTED: c++98, c++03
|
||||
|
||||
// <string>
|
||||
|
||||
// basic_string& replace(const_iterator i1, const_iterator i2, initializer_list<charT> il);
|
||||
@@ -20,15 +18,19 @@
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// UNSUPPORTED: c++98, c++03
|
||||
|
||||
// <string>
|
||||
|
||||
// template<class charT, class traits, class Allocator>
|
||||
@@ -24,6 +22,7 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
{
|
||||
std::string s("initial text");
|
||||
getline(std::istringstream(" abc* def* ghij"), s, '*');
|
||||
@@ -34,6 +33,7 @@ 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,4 +46,6 @@ int main()
|
||||
getline(std::wistringstream(L" abc* def* ghij"), s, L'*');
|
||||
assert(s == L" abc");
|
||||
}
|
||||
#endif
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
}
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// UNSUPPORTED: c++98, c++03
|
||||
|
||||
// <string>
|
||||
|
||||
// template<class charT, class traits, class Allocator>
|
||||
@@ -24,6 +22,7 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
{
|
||||
std::string s("initial text");
|
||||
getline(std::istringstream(" abc\n def\n ghij"), s);
|
||||
@@ -34,6 +33,7 @@ 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,4 +46,6 @@ int main()
|
||||
getline(std::wistringstream(L" abc\n def\n ghij"), s);
|
||||
assert(s == L" abc");
|
||||
}
|
||||
#endif
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
}
|
||||
|
||||
@@ -21,50 +21,60 @@
|
||||
#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);
|
||||
}
|
||||
|
||||
#if TEST_STD_VER >= 11
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
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
|
||||
|
||||
int main() {
|
||||
{
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
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
|
||||
|
||||
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::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"));
|
||||
}
|
||||
{
|
||||
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
|
||||
}
|
||||
|
||||
@@ -21,23 +21,29 @@
|
||||
#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);
|
||||
}
|
||||
|
||||
#if TEST_STD_VER >= 11
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
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
|
||||
|
||||
int main() {
|
||||
{
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef std::string S;
|
||||
test0("", S(""), S(""));
|
||||
test0("", S("12345"), S("12345"));
|
||||
@@ -50,43 +56,36 @@ 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"));
|
||||
}
|
||||
test0("abcdefghijklmnopqrst", S("1234567890"), S("abcdefghijklmnopqrst1234567890"));
|
||||
test0("abcdefghijklmnopqrst", S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890"));
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
test1("", S(""), S(""));
|
||||
test1("", S("12345"), S("12345"));
|
||||
test1("", S("1234567890"), S("1234567890"));
|
||||
test1("", S("12345678901234567890"), S("12345678901234567890"));
|
||||
test1("abcde", S(""), S("abcde"));
|
||||
test1("abcde", S("12345"), S("abcde12345"));
|
||||
test1("abcde", S("1234567890"), S("abcde1234567890"));
|
||||
test1("abcde", S("12345678901234567890"), S("abcde12345678901234567890"));
|
||||
test1("abcdefghij", S(""), S("abcdefghij"));
|
||||
test1("abcdefghij", S("12345"), S("abcdefghij12345"));
|
||||
test1("abcdefghij", S("1234567890"), S("abcdefghij1234567890"));
|
||||
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::string S;
|
||||
test1("", S(""), S(""));
|
||||
test1("", S("12345"), S("12345"));
|
||||
test1("", S("1234567890"), S("1234567890"));
|
||||
test1("", S("12345678901234567890"), S("12345678901234567890"));
|
||||
test1("abcde", S(""), S("abcde"));
|
||||
test1("abcde", S("12345"), S("abcde12345"));
|
||||
test1("abcde", S("1234567890"), S("abcde1234567890"));
|
||||
test1("abcde", S("12345678901234567890"), S("abcde12345678901234567890"));
|
||||
test1("abcdefghij", S(""), S("abcdefghij"));
|
||||
test1("abcdefghij", S("12345"), S("abcdefghij12345"));
|
||||
test1("abcdefghij", S("1234567890"), S("abcdefghij1234567890"));
|
||||
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"));
|
||||
}
|
||||
{
|
||||
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(""), S(""));
|
||||
test0("", S("12345"), S("12345"));
|
||||
test0("", S("1234567890"), S("1234567890"));
|
||||
@@ -98,14 +97,13 @@ 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"));
|
||||
test0("abcdefghijklmnopqrst", S("1234567890"), S("abcdefghijklmnopqrst1234567890"));
|
||||
test0("abcdefghijklmnopqrst", S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890"));
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
test1("", S(""), S(""));
|
||||
test1("", S("12345"), S("12345"));
|
||||
@@ -118,14 +116,13 @@ 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"));
|
||||
}
|
||||
test1("abcdefghijklmnopqrst", S("1234567890"), S("abcdefghijklmnopqrst1234567890"));
|
||||
test1("abcdefghijklmnopqrst", S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890"));
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -21,50 +21,60 @@
|
||||
#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);
|
||||
}
|
||||
|
||||
#if TEST_STD_VER >= 11
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
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
|
||||
|
||||
int main() {
|
||||
{
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
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
|
||||
|
||||
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::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"));
|
||||
}
|
||||
{
|
||||
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
|
||||
}
|
||||
|
||||
@@ -21,23 +21,29 @@
|
||||
#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);
|
||||
}
|
||||
|
||||
#if TEST_STD_VER >= 11
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
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
|
||||
|
||||
int main() {
|
||||
{
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef std::string S;
|
||||
test0(S(""), "", S(""));
|
||||
test0(S(""), "12345", S("12345"));
|
||||
@@ -50,42 +56,36 @@ 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"));
|
||||
}
|
||||
test0(S("abcdefghijklmnopqrst"), "1234567890", S("abcdefghijklmnopqrst1234567890"));
|
||||
test0(S("abcdefghijklmnopqrst"), "12345678901234567890", S("abcdefghijklmnopqrst12345678901234567890"));
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
test1(S(""), "", S(""));
|
||||
test1(S(""), "12345", S("12345"));
|
||||
test1(S(""), "1234567890", S("1234567890"));
|
||||
test1(S(""), "12345678901234567890", S("12345678901234567890"));
|
||||
test1(S("abcde"), "", S("abcde"));
|
||||
test1(S("abcde"), "12345", S("abcde12345"));
|
||||
test1(S("abcde"), "1234567890", S("abcde1234567890"));
|
||||
test1(S("abcde"), "12345678901234567890", S("abcde12345678901234567890"));
|
||||
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("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::string S;
|
||||
test1(S(""), "", S(""));
|
||||
test1(S(""), "12345", S("12345"));
|
||||
test1(S(""), "1234567890", S("1234567890"));
|
||||
test1(S(""), "12345678901234567890", S("12345678901234567890"));
|
||||
test1(S("abcde"), "", S("abcde"));
|
||||
test1(S("abcde"), "12345", S("abcde12345"));
|
||||
test1(S("abcde"), "1234567890", S("abcde1234567890"));
|
||||
test1(S("abcde"), "12345678901234567890", S("abcde12345678901234567890"));
|
||||
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("abcdefghijklmnopqrst"), "", S("abcdefghijklmnopqrst"));
|
||||
test1(S("abcdefghijklmnopqrst"), "12345", S("abcdefghijklmnopqrst12345"));
|
||||
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;
|
||||
{
|
||||
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,14 +97,13 @@ 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"));
|
||||
test0(S("abcdefghijklmnopqrst"), "1234567890", S("abcdefghijklmnopqrst1234567890"));
|
||||
test0(S("abcdefghijklmnopqrst"), "12345678901234567890", S("abcdefghijklmnopqrst12345678901234567890"));
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
test1(S(""), "", S(""));
|
||||
test1(S(""), "12345", S("12345"));
|
||||
@@ -117,14 +116,13 @@ 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"));
|
||||
}
|
||||
test1(S("abcdefghijklmnopqrst"), "1234567890", S("abcdefghijklmnopqrst1234567890"));
|
||||
test1(S("abcdefghijklmnopqrst"), "12345678901234567890", S("abcdefghijklmnopqrst12345678901234567890"));
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -33,217 +33,190 @@
|
||||
#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
|
||||
|
||||
template <class S>
|
||||
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);
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void
|
||||
test3(S&& lhs, S&& rhs, const S& x)
|
||||
{
|
||||
assert(move(lhs) + move(rhs) == x);
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef std::string S;
|
||||
test0(S(""), S(""), S(""));
|
||||
test0(S(""), S("12345"), S("12345"));
|
||||
test0(S(""), S("1234567890"), S("1234567890"));
|
||||
test0(S(""), S("12345678901234567890"), S("12345678901234567890"));
|
||||
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("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("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
|
||||
|
||||
test1(S(""), S(""), S(""));
|
||||
test1(S(""), S("12345"), S("12345"));
|
||||
test1(S(""), S("1234567890"), S("1234567890"));
|
||||
test1(S(""), S("12345678901234567890"), S("12345678901234567890"));
|
||||
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("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("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"));
|
||||
|
||||
test2(S(""), S(""), S(""));
|
||||
test2(S(""), S("12345"), S("12345"));
|
||||
test2(S(""), S("1234567890"), S("1234567890"));
|
||||
test2(S(""), S("12345678901234567890"), S("12345678901234567890"));
|
||||
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("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("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"));
|
||||
|
||||
test3(S(""), S(""), S(""));
|
||||
test3(S(""), S("12345"), S("12345"));
|
||||
test3(S(""), S("1234567890"), S("1234567890"));
|
||||
test3(S(""), S("12345678901234567890"), S("12345678901234567890"));
|
||||
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("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("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
|
||||
template <class S>
|
||||
void test1(S&& lhs, const S& rhs, const S& x) {
|
||||
assert(move(lhs) + rhs == x);
|
||||
}
|
||||
{
|
||||
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"));
|
||||
test0(S(""), S("12345678901234567890"), S("12345678901234567890"));
|
||||
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("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("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"));
|
||||
|
||||
template <class S>
|
||||
void test2(const S& lhs, S&& rhs, const S& x) {
|
||||
assert(lhs + move(rhs) == x);
|
||||
}
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class S>
|
||||
void test3(S&& lhs, S&& rhs, const S& x) {
|
||||
assert(move(lhs) + move(rhs) == x);
|
||||
}
|
||||
test1(S(""), S(""), S(""));
|
||||
test1(S(""), S("12345"), S("12345"));
|
||||
test1(S(""), S("1234567890"), S("1234567890"));
|
||||
test1(S(""), S("12345678901234567890"), S("12345678901234567890"));
|
||||
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("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("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"));
|
||||
|
||||
test2(S(""), S(""), S(""));
|
||||
test2(S(""), S("12345"), S("12345"));
|
||||
test2(S(""), S("1234567890"), S("1234567890"));
|
||||
test2(S(""), S("12345678901234567890"), S("12345678901234567890"));
|
||||
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("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("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"));
|
||||
|
||||
test3(S(""), S(""), S(""));
|
||||
test3(S(""), S("12345"), S("12345"));
|
||||
test3(S(""), S("1234567890"), S("1234567890"));
|
||||
test3(S(""), S("12345678901234567890"), S("12345678901234567890"));
|
||||
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("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("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
|
||||
|
||||
int main() {
|
||||
{
|
||||
typedef std::string S;
|
||||
test0(S(""), S(""), S(""));
|
||||
test0(S(""), S("12345"), S("12345"));
|
||||
test0(S(""), S("1234567890"), S("1234567890"));
|
||||
test0(S(""), S("12345678901234567890"), S("12345678901234567890"));
|
||||
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("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("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"));
|
||||
}
|
||||
#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"));
|
||||
test1(S(""), S("12345678901234567890"), S("12345678901234567890"));
|
||||
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("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("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"));
|
||||
|
||||
test2(S(""), S(""), S(""));
|
||||
test2(S(""), S("12345"), S("12345"));
|
||||
test2(S(""), S("1234567890"), S("1234567890"));
|
||||
test2(S(""), S("12345678901234567890"), S("12345678901234567890"));
|
||||
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("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("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"));
|
||||
|
||||
test3(S(""), S(""), S(""));
|
||||
test3(S(""), S("12345"), S("12345"));
|
||||
test3(S(""), S("1234567890"), S("1234567890"));
|
||||
test3(S(""), S("12345678901234567890"), S("12345678901234567890"));
|
||||
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("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("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"));
|
||||
}
|
||||
{
|
||||
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"));
|
||||
test0(S(""), S("12345678901234567890"), S("12345678901234567890"));
|
||||
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("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("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"));
|
||||
|
||||
test1(S(""), S(""), S(""));
|
||||
test1(S(""), S("12345"), S("12345"));
|
||||
test1(S(""), S("1234567890"), S("1234567890"));
|
||||
test1(S(""), S("12345678901234567890"), S("12345678901234567890"));
|
||||
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("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("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"));
|
||||
|
||||
test2(S(""), S(""), S(""));
|
||||
test2(S(""), S("12345"), S("12345"));
|
||||
test2(S(""), S("1234567890"), S("1234567890"));
|
||||
test2(S(""), S("12345678901234567890"), S("12345678901234567890"));
|
||||
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("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("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"));
|
||||
|
||||
test3(S(""), S(""), S(""));
|
||||
test3(S(""), S("12345"), S("12345"));
|
||||
test3(S(""), S("1234567890"), S("1234567890"));
|
||||
test3(S(""), S("12345678901234567890"), S("12345678901234567890"));
|
||||
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("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("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 // TEST_STD_VER >= 11
|
||||
}
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <string>
|
||||
// The strings's value type must be the same as the traits's char_type
|
||||
|
||||
#include <string>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::basic_string<char, std::char_traits<wchar_t>> s;
|
||||
}
|
||||
Reference in New Issue
Block a user