🔀 merge branch 'develop' into feature/exceptions_3.0.0

This commit is contained in:
Niels Lohmann 2017-03-12 20:22:30 +01:00
commit 855cdcf05c
No known key found for this signature in database
GPG key ID: 7F3CEA63AE251B69
8 changed files with 229 additions and 90 deletions

View file

@ -702,11 +702,17 @@ TEST_CASE("constructors")
SECTION("infinity")
{
// infinity is stored as null
// should change in the future: https://github.com/nlohmann/json/issues/388
// infinity is stored properly, but serialized to null
json::number_float_t n(std::numeric_limits<json::number_float_t>::infinity());
json j(n);
CHECK(j.type() == json::value_t::null);
CHECK(j.type() == json::value_t::number_float);
// check round trip of infinity
json::number_float_t d = j;
CHECK(d == n);
// check that inf is serialized to null
CHECK(j.dump() == "null");
}
}