mirror of
https://github.com/llvm-mirror/libcxx.git
synced 2025-10-23 10:07:41 +08:00
[libcxx] [test] Untabify, NFC.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@309464 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -42,12 +42,12 @@ test_exceptions(S s, typename S::size_type pos1, typename S::size_type n1, It f,
|
||||
{
|
||||
typename S::const_iterator first = s.begin() + pos1;
|
||||
typename S::const_iterator last = s.begin() + pos1 + n1;
|
||||
S aCopy = s;
|
||||
try {
|
||||
s.replace(first, last, f, l);
|
||||
assert(false);
|
||||
}
|
||||
catch (...) {}
|
||||
S aCopy = s;
|
||||
try {
|
||||
s.replace(first, last, f, l);
|
||||
assert(false);
|
||||
}
|
||||
catch (...) {}
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
assert(s == aCopy);
|
||||
}
|
||||
@@ -993,7 +993,7 @@ int main()
|
||||
}
|
||||
#endif
|
||||
#ifndef TEST_HAS_NO_EXCEPTIONS
|
||||
{ // test iterator operations that throw
|
||||
{ // test iterator operations that throw
|
||||
typedef std::string S;
|
||||
typedef ThrowingIterator<char> TIter;
|
||||
typedef input_iterator<TIter> IIter;
|
||||
@@ -1005,36 +1005,36 @@ int main()
|
||||
test_exceptions(S("abcdefghijklmnopqrst"), 10, 5, TIter(s, s+10, 4, TIter::TAIncrement), TIter());
|
||||
test_exceptions(S("abcdefghijklmnopqrst"), 10, 5, TIter(s, s+10, 5, TIter::TADereference), TIter());
|
||||
test_exceptions(S("abcdefghijklmnopqrst"), 10, 5, TIter(s, s+10, 6, TIter::TAComparison), TIter());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
{ // test replacing into self
|
||||
{ // test replacing into self
|
||||
typedef std::string S;
|
||||
S s_short = "123/";
|
||||
S s_long = "Lorem ipsum dolor sit amet, consectetur/";
|
||||
S s_short = "123/";
|
||||
S s_long = "Lorem ipsum dolor sit amet, consectetur/";
|
||||
|
||||
s_short.replace(s_short.begin(), s_short.begin(), s_short.begin(), s_short.end());
|
||||
assert(s_short == "123/123/");
|
||||
s_short.replace(s_short.begin(), s_short.begin(), s_short.begin(), s_short.end());
|
||||
assert(s_short == "123/123/123/123/");
|
||||
s_short.replace(s_short.begin(), s_short.begin(), s_short.begin(), s_short.end());
|
||||
assert(s_short == "123/123/123/123/123/123/123/123/");
|
||||
s_short.replace(s_short.begin(), s_short.begin(), s_short.begin(), s_short.end());
|
||||
assert(s_short == "123/123/");
|
||||
s_short.replace(s_short.begin(), s_short.begin(), s_short.begin(), s_short.end());
|
||||
assert(s_short == "123/123/123/123/");
|
||||
s_short.replace(s_short.begin(), s_short.begin(), s_short.begin(), s_short.end());
|
||||
assert(s_short == "123/123/123/123/123/123/123/123/");
|
||||
|
||||
s_long.replace(s_long.begin(), s_long.begin(), s_long.begin(), s_long.end());
|
||||
assert(s_long == "Lorem ipsum dolor sit amet, consectetur/Lorem ipsum dolor sit amet, consectetur/");
|
||||
}
|
||||
s_long.replace(s_long.begin(), s_long.begin(), s_long.begin(), s_long.end());
|
||||
assert(s_long == "Lorem ipsum dolor sit amet, consectetur/Lorem ipsum dolor sit amet, consectetur/");
|
||||
}
|
||||
|
||||
{ // test assigning a different type
|
||||
{ // test assigning a different type
|
||||
typedef std::string S;
|
||||
const uint8_t pc[] = "ABCD";
|
||||
uint8_t p[] = "EFGH";
|
||||
const uint8_t pc[] = "ABCD";
|
||||
uint8_t p[] = "EFGH";
|
||||
|
||||
S s;
|
||||
s.replace(s.begin(), s.end(), pc, pc + 4);
|
||||
assert(s == "ABCD");
|
||||
S s;
|
||||
s.replace(s.begin(), s.end(), pc, pc + 4);
|
||||
assert(s == "ABCD");
|
||||
|
||||
s.clear();
|
||||
s.replace(s.begin(), s.end(), p, p + 4);
|
||||
assert(s == "EFGH");
|
||||
}
|
||||
s.clear();
|
||||
s.replace(s.begin(), s.end(), p, p + 4);
|
||||
assert(s == "EFGH");
|
||||
}
|
||||
}
|
||||
|
@@ -283,19 +283,19 @@ int main()
|
||||
}
|
||||
#endif
|
||||
|
||||
{ // test replacing into self
|
||||
{ // test replacing into self
|
||||
typedef std::string S;
|
||||
S s_short = "123/";
|
||||
S s_long = "Lorem ipsum dolor sit amet, consectetur/";
|
||||
S s_short = "123/";
|
||||
S s_long = "Lorem ipsum dolor sit amet, consectetur/";
|
||||
|
||||
s_short.replace(s_short.begin(), s_short.begin(), s_short.c_str());
|
||||
assert(s_short == "123/123/");
|
||||
s_short.replace(s_short.begin(), s_short.begin(), s_short.c_str());
|
||||
assert(s_short == "123/123/123/123/");
|
||||
s_short.replace(s_short.begin(), s_short.begin(), s_short.c_str());
|
||||
assert(s_short == "123/123/123/123/123/123/123/123/");
|
||||
s_short.replace(s_short.begin(), s_short.begin(), s_short.c_str());
|
||||
assert(s_short == "123/123/");
|
||||
s_short.replace(s_short.begin(), s_short.begin(), s_short.c_str());
|
||||
assert(s_short == "123/123/123/123/");
|
||||
s_short.replace(s_short.begin(), s_short.begin(), s_short.c_str());
|
||||
assert(s_short == "123/123/123/123/123/123/123/123/");
|
||||
|
||||
s_long.replace(s_long.begin(), s_long.begin(), s_long.c_str());
|
||||
assert(s_long == "Lorem ipsum dolor sit amet, consectetur/Lorem ipsum dolor sit amet, consectetur/");
|
||||
}
|
||||
s_long.replace(s_long.begin(), s_long.begin(), s_long.c_str());
|
||||
assert(s_long == "Lorem ipsum dolor sit amet, consectetur/Lorem ipsum dolor sit amet, consectetur/");
|
||||
}
|
||||
}
|
||||
|
@@ -973,19 +973,19 @@ int main()
|
||||
}
|
||||
#endif
|
||||
|
||||
{ // test replacing into self
|
||||
{ // test replacing into self
|
||||
typedef std::string S;
|
||||
S s_short = "123/";
|
||||
S s_long = "Lorem ipsum dolor sit amet, consectetur/";
|
||||
S s_short = "123/";
|
||||
S s_long = "Lorem ipsum dolor sit amet, consectetur/";
|
||||
|
||||
s_short.replace(s_short.begin(), s_short.begin(), s_short.data(), s_short.size());
|
||||
assert(s_short == "123/123/");
|
||||
s_short.replace(s_short.begin(), s_short.begin(), s_short.data(), s_short.size());
|
||||
assert(s_short == "123/123/123/123/");
|
||||
s_short.replace(s_short.begin(), s_short.begin(), s_short.data(), s_short.size());
|
||||
assert(s_short == "123/123/123/123/123/123/123/123/");
|
||||
s_short.replace(s_short.begin(), s_short.begin(), s_short.data(), s_short.size());
|
||||
assert(s_short == "123/123/");
|
||||
s_short.replace(s_short.begin(), s_short.begin(), s_short.data(), s_short.size());
|
||||
assert(s_short == "123/123/123/123/");
|
||||
s_short.replace(s_short.begin(), s_short.begin(), s_short.data(), s_short.size());
|
||||
assert(s_short == "123/123/123/123/123/123/123/123/");
|
||||
|
||||
s_long.replace(s_long.begin(), s_long.begin(), s_long.data(), s_long.size());
|
||||
assert(s_long == "Lorem ipsum dolor sit amet, consectetur/Lorem ipsum dolor sit amet, consectetur/");
|
||||
}
|
||||
s_long.replace(s_long.begin(), s_long.begin(), s_long.data(), s_long.size());
|
||||
assert(s_long == "Lorem ipsum dolor sit amet, consectetur/Lorem ipsum dolor sit amet, consectetur/");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user