mirror of
https://github.com/fmtlib/fmt.git
synced 2025-11-03 15:41:53 +01:00
More fixed precision tests
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user