diff options
| author | Brendan Emery <brendan.emery@esrlabs.com> | 2023-09-01 13:27:26 -0400 |
|---|---|---|
| committer | Louis Dionne <ldionne.2@gmail.com> | 2023-09-01 13:35:18 -0400 |
| commit | a40bada91aeda276a772acfbcae6e8de26755a11 (patch) | |
| tree | 7172f9ff2e363d52f1f314fdc4555fdfbd35289b /libcxx/test/std/strings/basic.string/string.cons/pointer_alloc.pass.cpp | |
| parent | 823151f0cfc8f031bcecb15c8246b5649e87b31a (diff) | |
[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
Diffstat (limited to 'libcxx/test/std/strings/basic.string/string.cons/pointer_alloc.pass.cpp')
| -rw-r--r-- | libcxx/test/std/strings/basic.string/string.cons/pointer_alloc.pass.cpp | 57 |
1 files changed, 26 insertions, 31 deletions
diff --git a/libcxx/test/std/strings/basic.string/string.cons/pointer_alloc.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/pointer_alloc.pass.cpp index b466eb14bd83..c7e31f5e64e0 100644 --- a/libcxx/test/std/strings/basic.string/string.cons/pointer_alloc.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.cons/pointer_alloc.pass.cpp @@ -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()); |
