From 5289dd600b30fd4efea0ecdaedc51d892ecff135 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Wed, 30 Jan 2019 06:56:46 -0800 Subject: [PATCH] Test formatting of special numbers --- test/grisu-test.cc | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/test/grisu-test.cc b/test/grisu-test.cc index bc4601ee..05f580dd 100644 --- a/test/grisu-test.cc +++ b/test/grisu-test.cc @@ -25,5 +25,17 @@ bool reported_skipped; void test_fixture##test_name() TEST(GrisuTest, NaN) { - EXPECT_EQ("nan", fmt::format("{}", std::numeric_limits::quiet_NaN())); + auto nan = std::numeric_limits::quiet_NaN(); + EXPECT_EQ("nan", fmt::format("{}", nan)); + EXPECT_EQ("-nan", fmt::format("{}", -nan)); +} + +TEST(GrisuTest, Inf) { + auto inf = std::numeric_limits::infinity(); + EXPECT_EQ("inf", fmt::format("{}", inf)); + EXPECT_EQ("-inf", fmt::format("{}", -inf)); +} + +TEST(GrisuTest, Zero) { + EXPECT_EQ("0", fmt::format("{}", 0.0)); }