Skip to content

Commit

Permalink
Apply coding conventions
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaut committed Dec 31, 2023
1 parent 4939d67 commit 8e6b254
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 20 deletions.
23 changes: 11 additions & 12 deletions test/chrono-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -627,12 +627,10 @@ TEST(chrono_test, locale) {
using dms = std::chrono::duration<double, std::milli>;

TEST(chrono_test, format_default_fp) {
typedef std::chrono::duration<float> fs;
EXPECT_EQ(fmt::format("{}", fs(1.234)), "1.234s");
typedef std::chrono::duration<float, std::milli> fms;
EXPECT_EQ(fmt::format("{}", fms(1.234)), "1.234ms");
typedef std::chrono::duration<double> ds;
EXPECT_EQ(fmt::format("{}", ds(1.234)), "1.234s");
EXPECT_EQ(fmt::format("{}", std::chrono::duration<float>(1.234)), "1.234s");
EXPECT_EQ(fmt::format("{}", std::chrono::duration<float, std::milli>(1.234)),
"1.234ms");
EXPECT_EQ(fmt::format("{}", std::chrono::duration<double>(1.234)), "1.234s");
EXPECT_EQ(fmt::format("{}", dms(1.234)), "1.234ms");
}

Expand Down Expand Up @@ -667,12 +665,13 @@ TEST(chrono_test, format_full_specs) {
}

TEST(chrono_test, format_simple_q) {
typedef std::chrono::duration<float> fs;
EXPECT_EQ(fmt::format("{:%Q %q}", fs(1.234)), "1.234 s");
typedef std::chrono::duration<float, std::milli> fms;
EXPECT_EQ(fmt::format("{:%Q %q}", fms(1.234)), "1.234 ms");
typedef std::chrono::duration<double> ds;
EXPECT_EQ(fmt::format("{:%Q %q}", ds(1.234)), "1.234 s");
EXPECT_EQ(fmt::format("{:%Q %q}", std::chrono::duration<float>(1.234)),
"1.234 s");
EXPECT_EQ(
fmt::format("{:%Q %q}", std::chrono::duration<float, std::milli>(1.234)),
"1.234 ms");
EXPECT_EQ(fmt::format("{:%Q %q}", std::chrono::duration<double>(1.234)),
"1.234 s");
EXPECT_EQ(fmt::format("{:%Q %q}", dms(1.234)), "1.234 ms");
}

Expand Down
4 changes: 2 additions & 2 deletions test/format-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -353,9 +353,9 @@ TEST(memory_buffer_test, move_assignment) {
}

TEST(memory_buffer_test, grow) {
typedef allocator_ref<mock_allocator<int>> Allocator;
using allocator = allocator_ref<mock_allocator<int>>;
mock_allocator<int> alloc;
basic_memory_buffer<int, 10, Allocator> buffer((Allocator(&alloc)));
basic_memory_buffer<int, 10, allocator> buffer((allocator(&alloc)));
buffer.resize(7);
using fmt::detail::to_unsigned;
for (int i = 0; i < 7; ++i) buffer[to_unsigned(i)] = i * i;
Expand Down
8 changes: 4 additions & 4 deletions test/posix-mock.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions test/printf-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -310,10 +310,10 @@ TEST(printf_test, dynamic_precision) {
}
}

template <typename T> struct make_signed { typedef T type; };
template <typename T> struct make_signed { using type = T; };

#define SPECIALIZE_MAKE_SIGNED(T, S) \
template <> struct make_signed<T> { typedef S type; }
template <> struct make_signed<T> { using type = S; }

SPECIALIZE_MAKE_SIGNED(char, signed char);
SPECIALIZE_MAKE_SIGNED(unsigned char, signed char);
Expand Down

0 comments on commit 8e6b254

Please sign in to comment.