From 70aa8a31a26d8605be14d43b6c40c53982c7db70 Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Fri, 23 Aug 2019 23:50:13 +0200 Subject: [PATCH] Add regression test for dumping the minimum value of int64_t --- test/src/unit-regression.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/src/unit-regression.cpp b/test/src/unit-regression.cpp index 866a985b..c9e8b0d7 100644 --- a/test/src/unit-regression.cpp +++ b/test/src/unit-regression.cpp @@ -1802,6 +1802,13 @@ TEST_CASE("regression tests") json j = json::parse("[-9223372036854775808]"); CHECK(j.dump() == "[-9223372036854775808]"); } + + SECTION("issue #1708 - minimum value of int64_t can be outputted") + { + constexpr auto smallest = (std::numeric_limits::min)(); + json j = smallest; + CHECK(j.dump() == std::to_string(smallest)); + } } #if not defined(JSON_NOEXCEPTION)