mirror of
https://github.com/fmtlib/fmt.git
synced 2025-11-01 22:51:44 +01:00
Add the 'n' float format specifier
This commit is contained in:
@@ -1424,7 +1424,7 @@ TEST(FormatterTest, FormatFloat) {
|
||||
}
|
||||
|
||||
TEST(FormatterTest, FormatDouble) {
|
||||
check_unknown_types(1.2, "eEfFgGaA%", "double");
|
||||
check_unknown_types(1.2, "eEfFgGaAn%", "double");
|
||||
EXPECT_EQ("0.0", format("{:}", 0.0));
|
||||
EXPECT_EQ("0.000000", format("{:f}", 0.0));
|
||||
EXPECT_EQ("0", format("{:g}", 0.0));
|
||||
@@ -1447,6 +1447,10 @@ TEST(FormatterTest, FormatDouble) {
|
||||
EXPECT_EQ(buffer, format("{:A}", -42.0));
|
||||
}
|
||||
|
||||
TEST(FormatterTest, FormatDoubleLocale) {
|
||||
EXPECT_EQ("1.23", format("{:n}", 1.23));
|
||||
}
|
||||
|
||||
TEST(FormatterTest, PrecisionRounding) {
|
||||
EXPECT_EQ("0", format("{:.0f}", 0.0));
|
||||
EXPECT_EQ("0", format("{:.0f}", 0.01));
|
||||
|
||||
Reference in New Issue
Block a user