mirror of
https://github.com/clang-retro/llvm.git
synced 2026-12-04 08:09:27 -08:00
[libc++] Apply clang formatting to all string unit tests
This applies clang-format to the std::string unit tests in preparation for landing https://reviews.llvm.org/D140550. Differential Revision: https://reviews.llvm.org/D140612
This commit is contained in:
1 parent
823151f0cf
commit
a40bada91a
417 files changed
+56733
-58199
No files matched your search
@@ -19,33 +19,25 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class S>
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(S str, typename S::value_type* s, typename S::size_type n,
|
||||
typename S::size_type pos)
|
||||
{
|
||||
const S& cs = str;
|
||||
if (pos <= cs.size())
|
||||
{
|
||||
typename S::size_type r = cs.copy(s, n, pos);
|
||||
typename S::size_type rlen = std::min(n, cs.size() - pos);
|
||||
assert(r == rlen);
|
||||
for (r = 0; r < rlen; ++r)
|
||||
assert(S::traits_type::eq(cs[pos+r], s[r]));
|
||||
}
|
||||
TEST_CONSTEXPR_CXX20 void test(S str, typename S::value_type* s, typename S::size_type n, typename S::size_type pos) {
|
||||
const S& cs = str;
|
||||
if (pos <= cs.size()) {
|
||||
typename S::size_type r = cs.copy(s, n, pos);
|
||||
typename S::size_type rlen = std::min(n, cs.size() - pos);
|
||||
assert(r == rlen);
|
||||
for (r = 0; r < rlen; ++r)
|
||||
assert(S::traits_type::eq(cs[pos + r], s[r]));
|
||||
}
|
||||
#ifndef TEST_HAS_NO_EXCEPTIONS
|
||||
else if (!TEST_IS_CONSTANT_EVALUATED)
|
||||
{
|
||||
try
|
||||
{
|
||||
typename S::size_type r = cs.copy(s, n, pos);
|
||||
((void)r); // Prevent unused warning
|
||||
assert(false);
|
||||
}
|
||||
catch (std::out_of_range&)
|
||||
{
|
||||
assert(pos > str.size());
|
||||
}
|
||||
else if (!TEST_IS_CONSTANT_EVALUATED) {
|
||||
try {
|
||||
typename S::size_type r = cs.copy(s, n, pos);
|
||||
((void)r); // Prevent unused warning
|
||||
assert(false);
|
||||
} catch (std::out_of_range&) {
|
||||
assert(pos > str.size());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -121,8 +113,7 @@ TEST_CONSTEXPR_CXX20 bool test() {
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER > 17
|
||||
static_assert(test());
|
||||
|
||||
Reference in new issue
Block a user