mirror of
https://github.com/fmtlib/fmt.git
synced 2024-12-24 12:14:26 +00:00
Add floating-point L specifier (#1624)
This commit is contained in:
parent
36ea32640f
commit
bbb6b357c7
@ -1287,6 +1287,7 @@ FMT_CONSTEXPR float_specs parse_float_type_spec(
|
||||
result.format = float_format::hex;
|
||||
break;
|
||||
case 'n':
|
||||
case 'L':
|
||||
result.locale = true;
|
||||
break;
|
||||
default:
|
||||
|
@ -1413,7 +1413,7 @@ TEST(FormatterTest, FormatFloat) {
|
||||
}
|
||||
|
||||
TEST(FormatterTest, FormatDouble) {
|
||||
check_unknown_types(1.2, "eEfFgGaAn%", "double");
|
||||
check_unknown_types(1.2, "eEfFgGaAnL%", "double");
|
||||
EXPECT_EQ("0.0", format("{:}", 0.0));
|
||||
EXPECT_EQ("0.000000", format("{:f}", 0.0));
|
||||
EXPECT_EQ("0", format("{:g}", 0.0));
|
||||
@ -1422,6 +1422,7 @@ TEST(FormatterTest, FormatDouble) {
|
||||
EXPECT_EQ("392.65", format("{:G}", 392.65));
|
||||
EXPECT_EQ("392.650000", format("{:f}", 392.65));
|
||||
EXPECT_EQ("392.650000", format("{:F}", 392.65));
|
||||
EXPECT_EQ("42", format("{:L}", 42.0));
|
||||
char buffer[BUFFER_SIZE];
|
||||
safe_sprintf(buffer, "%e", 392.65);
|
||||
EXPECT_EQ(buffer, format("{0:e}", 392.65));
|
||||
|
Loading…
Reference in New Issue
Block a user