mirror of
https://github.com/nlohmann/json.git
synced 2025-07-29 23:01:16 +03:00
added test case for #82
This commit is contained in:
@ -8786,4 +8786,26 @@ TEST_CASE("regression tests")
|
|||||||
// check everything in one line
|
// check everything in one line
|
||||||
CHECK(fields == json::parse(fields.dump()));
|
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));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user