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:
@@ -33,10 +33,10 @@ template <class S, class It>
|
||||
void
|
||||
test_exceptions(S s, It first, It last)
|
||||
{
|
||||
S aCopy = s;
|
||||
S aCopy = s;
|
||||
try {
|
||||
s.assign(first, last);
|
||||
assert(false);
|
||||
s.assign(first, last);
|
||||
assert(false);
|
||||
}
|
||||
catch (...) {}
|
||||
LIBCPP_ASSERT(s.__invariants());
|
||||
@@ -165,7 +165,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;
|
||||
@@ -177,32 +177,32 @@ int main()
|
||||
test_exceptions(S(), TIter(s, s+10, 4, TIter::TAIncrement), TIter());
|
||||
test_exceptions(S(), TIter(s, s+10, 5, TIter::TADereference), TIter());
|
||||
test_exceptions(S(), TIter(s, s+10, 6, TIter::TAComparison), TIter());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
{ // test assigning to self
|
||||
{ // test assigning to 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.assign(s_short.begin(), s_short.end());
|
||||
assert(s_short == "123/");
|
||||
s_short.assign(s_short.begin() + 2, s_short.end());
|
||||
assert(s_short == "3/");
|
||||
s_short.assign(s_short.begin(), s_short.end());
|
||||
assert(s_short == "123/");
|
||||
s_short.assign(s_short.begin() + 2, s_short.end());
|
||||
assert(s_short == "3/");
|
||||
|
||||
s_long.assign(s_long.begin(), s_long.end());
|
||||
assert(s_long == "Lorem ipsum dolor sit amet, consectetur/");
|
||||
s_long.assign(s_long.begin(), s_long.end());
|
||||
assert(s_long == "Lorem ipsum dolor sit amet, consectetur/");
|
||||
|
||||
s_long.assign(s_long.begin() + 30, s_long.end());
|
||||
assert(s_long == "nsectetur/");
|
||||
}
|
||||
s_long.assign(s_long.begin() + 30, s_long.end());
|
||||
assert(s_long == "nsectetur/");
|
||||
}
|
||||
|
||||
{ // test assigning a different type
|
||||
{ // test assigning a different type
|
||||
typedef std::string S;
|
||||
const uint8_t p[] = "ABCD";
|
||||
const uint8_t p[] = "ABCD";
|
||||
|
||||
S s;
|
||||
s.assign(p, p + 4);
|
||||
assert(s == "ABCD");
|
||||
}
|
||||
S s;
|
||||
s.assign(p, p + 4);
|
||||
assert(s == "ABCD");
|
||||
}
|
||||
}
|
||||
|
@@ -62,17 +62,17 @@ int main()
|
||||
}
|
||||
#endif
|
||||
|
||||
{ // test assignment to self
|
||||
{ // test assignment to 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.assign(s_short.c_str());
|
||||
assert(s_short == "123/");
|
||||
s_short.assign(s_short.c_str() + 2);
|
||||
assert(s_short == "3/");
|
||||
s_short.assign(s_short.c_str());
|
||||
assert(s_short == "123/");
|
||||
s_short.assign(s_short.c_str() + 2);
|
||||
assert(s_short == "3/");
|
||||
|
||||
s_long.assign(s_long.c_str() + 30);
|
||||
assert(s_long == "nsectetur/");
|
||||
}
|
||||
s_long.assign(s_long.c_str() + 30);
|
||||
assert(s_long == "nsectetur/");
|
||||
}
|
||||
}
|
||||
|
@@ -70,20 +70,20 @@ int main()
|
||||
S("12345678901234567890"));
|
||||
}
|
||||
#endif
|
||||
{ // test assign to self
|
||||
{ // test assign to 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.assign(s_short.data(), s_short.size());
|
||||
assert(s_short == "123/");
|
||||
s_short.assign(s_short.data() + 2, s_short.size() - 2);
|
||||
assert(s_short == "3/");
|
||||
s_short.assign(s_short.data(), s_short.size());
|
||||
assert(s_short == "123/");
|
||||
s_short.assign(s_short.data() + 2, s_short.size() - 2);
|
||||
assert(s_short == "3/");
|
||||
|
||||
s_long.assign(s_long.data(), s_long.size());
|
||||
assert(s_long == "Lorem ipsum dolor sit amet, consectetur/");
|
||||
s_long.assign(s_long.data(), s_long.size());
|
||||
assert(s_long == "Lorem ipsum dolor sit amet, consectetur/");
|
||||
|
||||
s_long.assign(s_long.data() + 2, 8 );
|
||||
assert(s_long == "rem ipsu");
|
||||
}
|
||||
s_long.assign(s_long.data() + 2, 8 );
|
||||
assert(s_long == "rem ipsu");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user