arduino/libraries/ArduinoJson/test/JsonObject/isNull.cpp

35 lines
683 B
C++
Raw Normal View History

2018-11-03 20:21:33 +00:00
// ArduinoJson - arduinojson.org
// Copyright Benoit Blanchon 2014-2018
// MIT License
#include <ArduinoJson.h>
#include <catch.hpp>
TEST_CASE("JsonObject::isNull()") {
2018-11-13 14:50:48 +00:00
DynamicJsonDocument doc;
SECTION("returns true") {
JsonObject obj;
REQUIRE(obj.isNull() == true);
}
SECTION("returns false") {
JsonObject obj = doc.to<JsonObject>();
REQUIRE(obj.isNull() == false);
2018-11-03 20:21:33 +00:00
}
2018-11-13 14:50:48 +00:00
}
TEST_CASE("JsonObjectConst::isNull()") {
DynamicJsonDocument doc;
2018-11-03 20:21:33 +00:00
2018-11-13 14:50:48 +00:00
SECTION("returns true") {
JsonObjectConst obj;
REQUIRE(obj.isNull() == true);
2018-11-03 20:21:33 +00:00
}
2018-11-13 14:50:48 +00:00
SECTION("returns false") {
JsonObjectConst obj = doc.to<JsonObject>();
REQUIRE(obj.isNull() == false);
2018-11-03 20:21:33 +00:00
}
}