Skip to content

Commit

Permalink
Fix clang -Wliteral-range warning
Browse files Browse the repository at this point in the history
  • Loading branch information
phprus committed Feb 19, 2022
1 parent 7b96420 commit 9cc694c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions test/format-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -948,8 +948,10 @@ TEST(format_test, precision) {
EXPECT_THAT(outputs,
testing::Contains(fmt::format("{:.838A}", -2.14001164E+38)));

auto ld = 8.43821965335442234493E-4933L;
EXPECT_EQ(fmt::format("{:.0}", ld), ld != 0 ? "8e-4933" : "0");
if (std::numeric_limits<long double>::digits == 64) {
auto ld = (std::numeric_limits<long double>::min)();
EXPECT_EQ(fmt::format("{:.0}", ld), ld != 0 ? "3e-4932" : "0");
}

EXPECT_EQ("123.", fmt::format("{:#.0f}", 123.0));
EXPECT_EQ("1.23", fmt::format("{:.02f}", 1.234));
Expand Down

0 comments on commit 9cc694c

Please sign in to comment.