Commit a2a87413 authored by Victor Zverovich's avatar Victor Zverovich

Fix issues with MSVC.

parent f4f35cd1
...@@ -196,7 +196,10 @@ void fmt::Formatter::FormatDouble( ...@@ -196,7 +196,10 @@ void fmt::Formatter::FormatDouble(
case 0: case 0:
type = 'g'; type = 'g';
break; break;
case 'e': case 'E': case 'f': case 'F': case 'g': case 'G': case 'e': case 'E': case 'f': case 'g': case 'G':
break;
case 'F':
type = 'f';
break; break;
default: default:
ReportUnknownType(type, "double"); ReportUnknownType(type, "double");
......
...@@ -480,8 +480,11 @@ TEST(FormatterTest, FormatDouble) { ...@@ -480,8 +480,11 @@ TEST(FormatterTest, FormatDouble) {
EXPECT_EQ("392.65", str(Format("{0:G}") << 392.65)); EXPECT_EQ("392.65", str(Format("{0:G}") << 392.65));
EXPECT_EQ("392.650000", str(Format("{0:f}") << 392.65)); EXPECT_EQ("392.650000", str(Format("{0:f}") << 392.65));
EXPECT_EQ("392.650000", str(Format("{0:F}") << 392.65)); EXPECT_EQ("392.650000", str(Format("{0:F}") << 392.65));
EXPECT_EQ("3.926500e+02", str(Format("{0:e}") << 392.65)); char buffer[256];
EXPECT_EQ("3.926500E+02", str(Format("{0:E}") << 392.65)); sprintf(buffer, "%e", 392.65);
EXPECT_EQ(buffer, str(Format("{0:e}") << 392.65));
sprintf(buffer, "%E", 392.65);
EXPECT_EQ(buffer, str(Format("{0:E}") << 392.65));
EXPECT_EQ("+0000392.6", str(Format("{0:+010.4g}") << 392.65)); EXPECT_EQ("+0000392.6", str(Format("{0:+010.4g}") << 392.65));
} }
...@@ -493,8 +496,10 @@ TEST(FormatterTest, FormatLongDouble) { ...@@ -493,8 +496,10 @@ TEST(FormatterTest, FormatLongDouble) {
EXPECT_EQ("392.65", str(Format("{0:G}") << 392.65l)); EXPECT_EQ("392.65", str(Format("{0:G}") << 392.65l));
EXPECT_EQ("392.650000", str(Format("{0:f}") << 392.65l)); EXPECT_EQ("392.650000", str(Format("{0:f}") << 392.65l));
EXPECT_EQ("392.650000", str(Format("{0:F}") << 392.65l)); EXPECT_EQ("392.650000", str(Format("{0:F}") << 392.65l));
EXPECT_EQ("3.926500e+02", str(Format("{0:e}") << 392.65l)); char buffer[256];
EXPECT_EQ("3.926500E+02", str(Format("{0:E}") << 392.65l)); sprintf(buffer, "%Le", 392.65);
EXPECT_EQ(buffer, str(Format("{0:e}") << 392.65));
sprintf(buffer, "%LE", 392.65);
EXPECT_EQ("+0000392.6", str(Format("{0:+010.4g}") << 392.65l)); EXPECT_EQ("+0000392.6", str(Format("{0:+010.4g}") << 392.65l));
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment