forked from bblanchon/ArduinoJson
Checked that issue issue #628 is fixed
This commit is contained in:
@ -87,6 +87,40 @@ TEST_CASE("deserializeJson(DynamicJsonDocument&)") {
|
|||||||
REQUIRE(doc.as<bool>() == false);
|
REQUIRE(doc.as<bool>() == false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SECTION("NaN") {
|
||||||
|
DeserializationError err = deserializeJson(doc, "NaN");
|
||||||
|
REQUIRE(err == DeserializationError::Ok);
|
||||||
|
REQUIRE(doc.is<float>() == true);
|
||||||
|
REQUIRE(Internals::isnan(doc.as<float>()));
|
||||||
|
}
|
||||||
|
|
||||||
|
SECTION("Infinity") {
|
||||||
|
DeserializationError err = deserializeJson(doc, "Infinity");
|
||||||
|
REQUIRE(err == DeserializationError::Ok);
|
||||||
|
REQUIRE(doc.is<float>() == true);
|
||||||
|
REQUIRE(Internals::isinf(doc.as<float>()));
|
||||||
|
}
|
||||||
|
|
||||||
|
SECTION("+Infinity") {
|
||||||
|
DeserializationError err = deserializeJson(doc, "+Infinity");
|
||||||
|
REQUIRE(err == DeserializationError::Ok);
|
||||||
|
REQUIRE(doc.is<float>() == true);
|
||||||
|
REQUIRE(Internals::isinf(doc.as<float>()));
|
||||||
|
}
|
||||||
|
|
||||||
|
SECTION("-Infinity") {
|
||||||
|
DeserializationError err = deserializeJson(doc, "-Infinity");
|
||||||
|
REQUIRE(err == DeserializationError::Ok);
|
||||||
|
REQUIRE(doc.is<float>() == true);
|
||||||
|
REQUIRE(Internals::isinf(doc.as<float>()));
|
||||||
|
}
|
||||||
|
|
||||||
|
SECTION("issue #628") {
|
||||||
|
DeserializationError err = deserializeJson(doc, "null");
|
||||||
|
REQUIRE(err == DeserializationError::Ok);
|
||||||
|
REQUIRE(doc.is<float>() == false);
|
||||||
|
}
|
||||||
|
|
||||||
SECTION("Should clear the JsonVariant") {
|
SECTION("Should clear the JsonVariant") {
|
||||||
deserializeJson(doc, "[1,2,3]");
|
deserializeJson(doc, "[1,2,3]");
|
||||||
deserializeJson(doc, "{}");
|
deserializeJson(doc, "{}");
|
||||||
|
Reference in New Issue
Block a user