[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
+56737
-58203
No files matched your search
@@ -21,38 +21,34 @@
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class charT>
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(const charT* s)
|
||||
{
|
||||
typedef std::basic_string<charT, std::char_traits<charT>, test_allocator<charT> > S;
|
||||
typedef typename S::traits_type T;
|
||||
typedef typename S::allocator_type A;
|
||||
std::size_t n = T::length(s);
|
||||
S s2(s);
|
||||
LIBCPP_ASSERT(s2.__invariants());
|
||||
assert(s2.size() == n);
|
||||
assert(T::compare(s2.data(), s, n) == 0);
|
||||
assert(s2.get_allocator() == A());
|
||||
assert(s2.capacity() >= s2.size());
|
||||
TEST_CONSTEXPR_CXX20 void test(const charT* s) {
|
||||
typedef std::basic_string<charT, std::char_traits<charT>, test_allocator<charT> > S;
|
||||
typedef typename S::traits_type T;
|
||||
typedef typename S::allocator_type A;
|
||||
std::size_t n = T::length(s);
|
||||
S s2(s);
|
||||
LIBCPP_ASSERT(s2.__invariants());
|
||||
assert(s2.size() == n);
|
||||
assert(T::compare(s2.data(), s, n) == 0);
|
||||
assert(s2.get_allocator() == A());
|
||||
assert(s2.capacity() >= s2.size());
|
||||
}
|
||||
|
||||
template <class charT, class A>
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
test(const charT* s, const A& a)
|
||||
{
|
||||
typedef std::basic_string<charT, std::char_traits<charT>, A> S;
|
||||
typedef typename S::traits_type T;
|
||||
std::size_t n = T::length(s);
|
||||
S s2(s, a);
|
||||
LIBCPP_ASSERT(s2.__invariants());
|
||||
assert(s2.size() == n);
|
||||
assert(T::compare(s2.data(), s, n) == 0);
|
||||
assert(s2.get_allocator() == a);
|
||||
assert(s2.capacity() >= s2.size());
|
||||
TEST_CONSTEXPR_CXX20 void test(const charT* s, const A& a) {
|
||||
typedef std::basic_string<charT, std::char_traits<charT>, A> S;
|
||||
typedef typename S::traits_type T;
|
||||
std::size_t n = T::length(s);
|
||||
S s2(s, a);
|
||||
LIBCPP_ASSERT(s2.__invariants());
|
||||
assert(s2.size() == n);
|
||||
assert(T::compare(s2.data(), s, n) == 0);
|
||||
assert(s2.get_allocator() == a);
|
||||
assert(s2.capacity() >= s2.size());
|
||||
}
|
||||
|
||||
TEST_CONSTEXPR_CXX20 bool test() {
|
||||
{
|
||||
{
|
||||
typedef test_allocator<char> A;
|
||||
|
||||
test("");
|
||||
@@ -66,9 +62,9 @@ TEST_CONSTEXPR_CXX20 bool test() {
|
||||
|
||||
test("123456798012345679801234567980123456798012345679801234567980");
|
||||
test("123456798012345679801234567980123456798012345679801234567980", A(2));
|
||||
}
|
||||
}
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
{
|
||||
typedef min_allocator<char> A;
|
||||
|
||||
test("");
|
||||
@@ -82,14 +78,13 @@ TEST_CONSTEXPR_CXX20 bool test() {
|
||||
|
||||
test("123456798012345679801234567980123456798012345679801234567980");
|
||||
test("123456798012345679801234567980123456798012345679801234567980", A());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
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