2018-07-12 09:08:20 +02:00
|
|
|
// ArduinoJson - arduinojson.org
|
|
|
|
// Copyright Benoit Blanchon 2014-2018
|
|
|
|
// MIT License
|
|
|
|
|
|
|
|
#include <ArduinoJson.h>
|
|
|
|
#include <catch.hpp>
|
|
|
|
|
|
|
|
TEST_CASE("JsonArray::isNull()") {
|
|
|
|
SECTION("returns true for undefined JsonArray") {
|
|
|
|
JsonArray array;
|
|
|
|
REQUIRE(array.isNull() == true);
|
|
|
|
}
|
|
|
|
|
|
|
|
SECTION("returns false when allocation succeeds") {
|
|
|
|
StaticJsonDocument<JSON_ARRAY_SIZE(0)> doc;
|
|
|
|
JsonArray array = doc.to<JsonArray>();
|
|
|
|
REQUIRE(array.isNull() == false);
|
|
|
|
}
|
|
|
|
|
2018-09-11 16:05:56 +02:00
|
|
|
/* SECTION("returns true when allocation fails") {
|
|
|
|
StaticJsonDocument<1> doc;
|
|
|
|
JsonArray array = doc.to<JsonArray>();
|
|
|
|
REQUIRE(array.isNull() == true);
|
|
|
|
}*/
|
2018-07-12 09:08:20 +02:00
|
|
|
}
|
2018-10-12 12:00:27 +02:00
|
|
|
|
|
|
|
TEST_CASE("JsonArrayConst::isNull()") {
|
|
|
|
SECTION("returns true for undefined JsonArray") {
|
|
|
|
JsonArrayConst array;
|
|
|
|
REQUIRE(array.isNull() == true);
|
|
|
|
}
|
|
|
|
|
|
|
|
SECTION("returns false when allocation succeeds") {
|
|
|
|
StaticJsonDocument<JSON_ARRAY_SIZE(0)> doc;
|
|
|
|
JsonArrayConst array = doc.to<JsonArray>();
|
|
|
|
REQUIRE(array.isNull() == false);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* SECTION("returns true when allocation fails") {
|
|
|
|
StaticJsonDocument<1> doc;
|
|
|
|
JsonArray array = doc.to<JsonArray>();
|
|
|
|
REQUIRE(array.isNull() == true);
|
|
|
|
}*/
|
|
|
|
}
|