diff --git a/format.h b/format.h index d29c080c..3674ac2d 100644 --- a/format.h +++ b/format.h @@ -1894,7 +1894,7 @@ class FormatInt { // a pointer to the end of the formatted string. This function doesn't // write a terminating null character. template -inline void FormatDec(char *&buffer, T value) { +inline void format_decimal(char *&buffer, T value) { typename internal::IntTraits::MainType abs_value = value; if (internal::is_negative(value)) { *buffer++ = '-'; diff --git a/test/format-test.cc b/test/format-test.cc index 60779868..fb4d39f9 100644 --- a/test/format-test.cc +++ b/test/format-test.cc @@ -1455,27 +1455,28 @@ TEST(FormatIntTest, FormatInt) { } template -std::string FormatDec(T value) { +std::string format_decimal(T value) { char buffer[10]; char *ptr = buffer; - fmt::FormatDec(ptr, value); + fmt::format_decimal(ptr, value); return std::string(buffer, ptr); } TEST(FormatIntTest, FormatDec) { - EXPECT_EQ("-42", FormatDec(static_cast(-42))); - EXPECT_EQ("-42", FormatDec(static_cast(-42))); + EXPECT_EQ("-42", format_decimal(static_cast(-42))); + EXPECT_EQ("-42", format_decimal(static_cast(-42))); std::ostringstream os; os << std::numeric_limits::max(); - EXPECT_EQ(os.str(), FormatDec(std::numeric_limits::max())); - EXPECT_EQ("1", FormatDec(1)); - EXPECT_EQ("-1", FormatDec(-1)); - EXPECT_EQ("42", FormatDec(42)); - EXPECT_EQ("-42", FormatDec(-42)); - EXPECT_EQ("42", FormatDec(42l)); - EXPECT_EQ("42", FormatDec(42ul)); - EXPECT_EQ("42", FormatDec(42ll)); - EXPECT_EQ("42", FormatDec(42ull)); + EXPECT_EQ(os.str(), + format_decimal(std::numeric_limits::max())); + EXPECT_EQ("1", format_decimal(1)); + EXPECT_EQ("-1", format_decimal(-1)); + EXPECT_EQ("42", format_decimal(42)); + EXPECT_EQ("-42", format_decimal(-42)); + EXPECT_EQ("42", format_decimal(42l)); + EXPECT_EQ("42", format_decimal(42ul)); + EXPECT_EQ("42", format_decimal(42ll)); + EXPECT_EQ("42", format_decimal(42ull)); } TEST(FormatTest, Print) {