More fixed precision tests

This commit is contained in:
Victor Zverovich
2019-03-15 08:42:14 -07:00
parent dd6cc0e6ac
commit 97619e27a2
2 changed files with 8 additions and 3 deletions

View File

@@ -1476,7 +1476,13 @@ TEST(FormatterTest, PrecisionRounding) {
EXPECT_EQ("0.001", format("{:.3f}", 0.0005));
EXPECT_EQ("0.001", format("{:.3f}", 0.00149));
EXPECT_EQ("0.002", format("{:.3f}", 0.0015));
EXPECT_EQ("1.000", format("{:.3f}", 0.9999));
EXPECT_EQ("0.00123", format("{:.3}", 0.00123));
// Trigger rounding error in Grisu by a carefully chosen number.
auto n = 3788512123356.985352;
char buffer[64];
sprintf(buffer, "%f", n);
EXPECT_EQ(buffer, format("{:f}", n));
}
TEST(FormatterTest, FormatNaN) {