Skip to content

Commit

Permalink
added test case for #82
Browse files Browse the repository at this point in the history
  • Loading branch information
nlohmann committed Jun 4, 2015
1 parent b8d05f7 commit 29512ae
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test/unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}

0 comments on commit 29512ae

Please sign in to comment.