Skip to content

Commit

Permalink
Suppress a -Wliteral-range warning on Apple M1
Browse files Browse the repository at this point in the history
  • Loading branch information
phprus committed Apr 18, 2022
1 parent 5d804ee commit 28607bb
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions test/format-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "fmt/format.h"
// clang-format on

#include <float.h> // LDBL_MANT_DIG
#include <stdint.h> // uint32_t

#include <climits> // INT_MAX
Expand Down Expand Up @@ -1006,12 +1007,12 @@ TEST(format_test, precision) {
EXPECT_THAT(outputs,
testing::Contains(fmt::format("{:.838A}", -2.14001164E+38)));

if (std::numeric_limits<long double>::digits == 64) {
auto ld = (std::numeric_limits<long double>::min)();
EXPECT_EQ(fmt::format("{:.0}", ld), "3e-4932");
EXPECT_EQ(fmt::format("{:0g}", 5.02957084971264961283E-4940L),
"5.02957e-4940");
}
#if LDBL_MANT_DIG == 64
auto ld = (std::numeric_limits<long double>::min)();
EXPECT_EQ(fmt::format("{:.0}", ld), "3e-4932");
EXPECT_EQ(fmt::format("{:0g}", 5.02957084971264961283E-4940L),
"5.02957e-4940");
#endif

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

0 comments on commit 28607bb

Please sign in to comment.