From 8e6b2541a6cd0b21baef8cc6daa2631326e801fe Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Sat, 30 Dec 2023 16:07:35 -0800 Subject: [PATCH] Apply coding conventions --- test/chrono-test.cc | 23 +++++++++++------------ test/format-test.cc | 4 ++-- test/posix-mock.h | 8 ++++---- test/printf-test.cc | 4 ++-- 4 files changed, 19 insertions(+), 20 deletions(-) diff --git a/test/chrono-test.cc b/test/chrono-test.cc index d0c87dbb..b2d03f97 100644 --- a/test/chrono-test.cc +++ b/test/chrono-test.cc @@ -627,12 +627,10 @@ TEST(chrono_test, locale) { using dms = std::chrono::duration; TEST(chrono_test, format_default_fp) { - typedef std::chrono::duration fs; - EXPECT_EQ(fmt::format("{}", fs(1.234)), "1.234s"); - typedef std::chrono::duration fms; - EXPECT_EQ(fmt::format("{}", fms(1.234)), "1.234ms"); - typedef std::chrono::duration ds; - EXPECT_EQ(fmt::format("{}", ds(1.234)), "1.234s"); + EXPECT_EQ(fmt::format("{}", std::chrono::duration(1.234)), "1.234s"); + EXPECT_EQ(fmt::format("{}", std::chrono::duration(1.234)), + "1.234ms"); + EXPECT_EQ(fmt::format("{}", std::chrono::duration(1.234)), "1.234s"); EXPECT_EQ(fmt::format("{}", dms(1.234)), "1.234ms"); } @@ -667,12 +665,13 @@ TEST(chrono_test, format_full_specs) { } TEST(chrono_test, format_simple_q) { - typedef std::chrono::duration fs; - EXPECT_EQ(fmt::format("{:%Q %q}", fs(1.234)), "1.234 s"); - typedef std::chrono::duration fms; - EXPECT_EQ(fmt::format("{:%Q %q}", fms(1.234)), "1.234 ms"); - typedef std::chrono::duration ds; - EXPECT_EQ(fmt::format("{:%Q %q}", ds(1.234)), "1.234 s"); + EXPECT_EQ(fmt::format("{:%Q %q}", std::chrono::duration(1.234)), + "1.234 s"); + EXPECT_EQ( + fmt::format("{:%Q %q}", std::chrono::duration(1.234)), + "1.234 ms"); + EXPECT_EQ(fmt::format("{:%Q %q}", std::chrono::duration(1.234)), + "1.234 s"); EXPECT_EQ(fmt::format("{:%Q %q}", dms(1.234)), "1.234 ms"); } diff --git a/test/format-test.cc b/test/format-test.cc index 0f7fb008..325bef99 100644 --- a/test/format-test.cc +++ b/test/format-test.cc @@ -353,9 +353,9 @@ TEST(memory_buffer_test, move_assignment) { } TEST(memory_buffer_test, grow) { - typedef allocator_ref> Allocator; + using allocator = allocator_ref>; mock_allocator alloc; - basic_memory_buffer buffer((Allocator(&alloc))); + basic_memory_buffer buffer((allocator(&alloc))); buffer.resize(7); using fmt::detail::to_unsigned; for (int i = 0; i < 7; ++i) buffer[to_unsigned(i)] = i * i; diff --git a/test/posix-mock.h b/test/posix-mock.h index 4f2a42c1..54580871 100644 --- a/test/posix-mock.h +++ b/test/posix-mock.h @@ -30,13 +30,13 @@ namespace test { #ifndef _MSC_VER // Size type for read and write. -typedef size_t size_t; -typedef ssize_t ssize_t; +using size_t = size_t; +using ssize_t = ssize_t; int open(const char* path, int oflag, int mode); int fstat(int fd, struct stat* buf); #else -typedef unsigned size_t; -typedef int ssize_t; +using size_t = unsigned; +using ssize_t = int; #endif #ifndef _WIN32 diff --git a/test/printf-test.cc b/test/printf-test.cc index 81db9b23..7e09ecca 100644 --- a/test/printf-test.cc +++ b/test/printf-test.cc @@ -310,10 +310,10 @@ TEST(printf_test, dynamic_precision) { } } -template struct make_signed { typedef T type; }; +template struct make_signed { using type = T; }; #define SPECIALIZE_MAKE_SIGNED(T, S) \ - template <> struct make_signed { typedef S type; } + template <> struct make_signed { using type = S; } SPECIALIZE_MAKE_SIGNED(char, signed char); SPECIALIZE_MAKE_SIGNED(unsigned char, signed char);