diff --git a/test/format-test.cc b/test/format-test.cc index 6cd2b5ec..d6802f79 100644 --- a/test/format-test.cc +++ b/test/format-test.cc @@ -1361,14 +1361,11 @@ TEST(format_test, format_double) { EXPECT_EQ(fmt::format("{0:e}", 392.65), "3.926500e+02"); EXPECT_EQ(fmt::format("{0:E}", 392.65), "3.926500E+02"); EXPECT_EQ(fmt::format("{0:+010.4g}", 392.65), "+0000392.6"); - char buffer[buffer_size]; #if FMT_CPLUSPLUS >= 201703L double xd = 0x1.ffffffffffp+2; - safe_sprintf(buffer, "%.*a", 10, xd); - EXPECT_EQ(fmt::format("{:.10a}", xd), buffer); - safe_sprintf(buffer, "%.*a", 9, xd); - EXPECT_EQ(fmt::format("{:.9a}", xd), buffer); + EXPECT_EQ(fmt::format("{:.10a}", xd), "0x1.ffffffffffp+2"); + EXPECT_EQ(fmt::format("{:.9a}", xd), "0x2.000000000p+2"); if (std::numeric_limits::digits == 64) { auto ld = 0xf.ffffffffffp-3l; @@ -1384,8 +1381,7 @@ TEST(format_test, format_double) { EXPECT_EQ(fmt::format("{:#a}", d), "0x1.p-1022"); d = (std::numeric_limits::max)(); - safe_sprintf(buffer, "%a", d); - EXPECT_EQ(fmt::format("{:a}", d), buffer); + EXPECT_EQ(fmt::format("{:a}", d), "0x1.fffffffffffffp+1023"); d = std::numeric_limits::denorm_min(); EXPECT_EQ(fmt::format("{:a}", d), "0x0.0000000000001p-1022"); @@ -1402,8 +1398,7 @@ TEST(format_test, format_double) { EXPECT_EQ(fmt::format("{:a}", ld), "0x0.000000000000001p-16382"); } - safe_sprintf(buffer, "%.*a", 10, 4.2); - EXPECT_EQ(fmt::format("{:.10a}", 4.2), buffer); + EXPECT_EQ(fmt::format("{:.10a}", 4.2), "0x1.0ccccccccdp+2"); EXPECT_EQ(fmt::format("{:a}", -42.0), "-0x1.5p+5"); EXPECT_EQ(fmt::format("{:A}", -42.0), "-0X1.5P+5");