Cleanup _LIBCPP_HAS_NO_<c++11-feature> in the string library.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300633 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user