From 29512ae9899374d1b184f77ad4b7d4c8428f7b46 Mon Sep 17 00:00:00 2001 From: Niels Date: Thu, 4 Jun 2015 20:07:33 +0200 Subject: [PATCH] added test case for #82 --- test/unit.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/test/unit.cpp b/test/unit.cpp index 5d3f1f3c..ec0f9f27 100644 --- a/test/unit.cpp +++ b/test/unit.cpp @@ -8786,4 +8786,26 @@ TEST_CASE("regression tests") // check everything in one line CHECK(fields == json::parse(fields.dump())); } + + SECTION("issue #82 - lexer::get_number return NAN") + { + const auto content = R"( + { + "Test":"Test1", + "Number":100, + "Foo":42.42 + })"; + + std::stringstream ss; + ss << content; + json j; + ss >> j; + + std::string test = j["Test"]; + CHECK(test == "Test1"); + int number = j["Number"]; + CHECK(number == 100); + float foo = j["Foo"]; + CHECK(foo == Approx(42.42)); + } }