Revert "Merge to upstream r304942."
This reverts commit83b1388ecd, reversing changes made tof20819f925. Test: treehugger Bug: None
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user