Skip to content

Commit 5a8bf1f

Browse files
committed
Workaround hexfloat inconsistency on windows (#2205)
1 parent 78776ee commit 5a8bf1f

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

test/format-test.cc

+19-3
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ using fmt::wmemory_buffer;
4646
using fmt::wstring_view;
4747
using fmt::detail::max_value;
4848

49+
using testing::Contains;
4950
using testing::Return;
5051
using testing::StrictMock;
5152

@@ -224,7 +225,8 @@ TEST(BufferAppenderTest, BufferAppenderDefaultConstruct) {
224225
static_assert(
225226
std::is_default_constructible<
226227
std::back_insert_iterator<fmt::detail::buffer<char>>>::value ==
227-
std::is_default_constructible<fmt::detail::buffer_appender<char>>::value,
228+
std::is_default_constructible<
229+
fmt::detail::buffer_appender<char>>::value,
228230
"");
229231
}
230232

@@ -994,7 +996,8 @@ TEST(FormatterTest, Precision) {
994996
"012970999954193198940908041656332452475714786901472678015935523861155013"
995997
"480352649347201937902681071074917033322268447533357208324319361e-324",
996998
format("{:.494}", 4.9406564584124654E-324));
997-
EXPECT_EQ(
999+
1000+
std::string outputs[] = {
9981001
"-0X1.41FE3FFE71C9E000000000000000000000000000000000000000000000000000000"
9991002
"000000000000000000000000000000000000000000000000000000000000000000000000"
10001003
"000000000000000000000000000000000000000000000000000000000000000000000000"
@@ -1007,7 +1010,20 @@ TEST(FormatterTest, Precision) {
10071010
"000000000000000000000000000000000000000000000000000000000000000000000000"
10081011
"000000000000000000000000000000000000000000000000000000000000000000000000"
10091012
"000000000000000000000000000000000000000000000000000P+127",
1010-
format("{:.838A}", -2.14001164E+38));
1013+
"-0XA.0FF1FFF38E4F0000000000000000000000000000000000000000000000000000000"
1014+
"000000000000000000000000000000000000000000000000000000000000000000000000"
1015+
"000000000000000000000000000000000000000000000000000000000000000000000000"
1016+
"000000000000000000000000000000000000000000000000000000000000000000000000"
1017+
"000000000000000000000000000000000000000000000000000000000000000000000000"
1018+
"000000000000000000000000000000000000000000000000000000000000000000000000"
1019+
"000000000000000000000000000000000000000000000000000000000000000000000000"
1020+
"000000000000000000000000000000000000000000000000000000000000000000000000"
1021+
"000000000000000000000000000000000000000000000000000000000000000000000000"
1022+
"000000000000000000000000000000000000000000000000000000000000000000000000"
1023+
"000000000000000000000000000000000000000000000000000000000000000000000000"
1024+
"000000000000000000000000000000000000000000000000000P+124"};
1025+
EXPECT_THAT(outputs, Contains(format("{:.838A}", -2.14001164E+38)));
1026+
10111027
EXPECT_EQ("123.", format("{:#.0f}", 123.0));
10121028
EXPECT_EQ("1.23", format("{:.02f}", 1.234));
10131029
EXPECT_EQ("0.001", format("{:.1g}", 0.001));

0 commit comments

Comments
 (0)