Added EXPECT expressions for the situation described in issue #1917, as well as for similar situations.
format("{:.1e}", 1e-12)
Actual: 1.00e-12
Expected: 1.0e-12
This commit is contained in:
parent
b91d39f20b
commit
5bcd642bcc
@ -958,6 +958,10 @@ TEST(FormatterTest, Precision) {
|
|||||||
EXPECT_EQ("1019666400", format("{}", 1019666432.0f));
|
EXPECT_EQ("1019666400", format("{}", 1019666432.0f));
|
||||||
EXPECT_EQ("1e+01", format("{:.0e}", 9.5));
|
EXPECT_EQ("1e+01", format("{:.0e}", 9.5));
|
||||||
|
|
||||||
|
EXPECT_EQ("1.0e-02", format("{:.1e}", 1e-2));
|
||||||
|
EXPECT_EQ("1.0e-12", format("{:.1e}", 1e-12));
|
||||||
|
EXPECT_EQ("1.0e+12", format("{:.1e}", 1e12));
|
||||||
|
|
||||||
EXPECT_THROW_MSG(format("{0:.2}", reinterpret_cast<void*>(0xcafe)),
|
EXPECT_THROW_MSG(format("{0:.2}", reinterpret_cast<void*>(0xcafe)),
|
||||||
format_error,
|
format_error,
|
||||||
"precision not allowed for this argument type");
|
"precision not allowed for this argument type");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user