Don't emit trailing zero for consistency with std::format
This commit is contained in:
+2
-3
@@ -151,10 +151,9 @@ FMT_END_NAMESPACE
|
||||
|
||||
TEST(FormatTest, Complex) {
|
||||
std::string s = fmt::format("{}", std::complex<double>(1, 2));
|
||||
// We might want to drop trailing zeros for consistency with to_chars.
|
||||
EXPECT_EQ(s, "(1.0+2.0i)");
|
||||
EXPECT_EQ(s, "(1+2i)");
|
||||
EXPECT_EQ(fmt::format("{:.2f}", std::complex<double>(1, 2)), "(1.00+2.00i)");
|
||||
EXPECT_EQ(fmt::format("{:12}", std::complex<double>(1, 2)), " (1.0+2.0i)");
|
||||
EXPECT_EQ(fmt::format("{:8}", std::complex<double>(1, 2)), " (1+2i)");
|
||||
}
|
||||
|
||||
#endif // FMT_STATIC_THOUSANDS_SEPARATOR
|
||||
|
||||
Reference in New Issue
Block a user