2017-11-07 20:42:50 +01:00
|
|
|
// ArduinoJson - arduinojson.org
|
2018-01-05 09:20:01 +01:00
|
|
|
// Copyright Benoit Blanchon 2014-2018
|
2015-09-28 22:14:50 +02:00
|
|
|
// MIT License
|
|
|
|
|
|
|
|
#include <ArduinoJson.h>
|
2017-04-18 18:22:24 +02:00
|
|
|
#include <catch.hpp>
|
2015-09-28 22:14:50 +02:00
|
|
|
|
2017-04-18 18:22:24 +02:00
|
|
|
TEST_CASE("JsonArray basics") {
|
2018-02-26 16:05:16 +01:00
|
|
|
DynamicJsonArray array;
|
2015-09-28 22:14:50 +02:00
|
|
|
|
2017-04-18 18:22:24 +02:00
|
|
|
SECTION("SuccessIsTrue") {
|
|
|
|
REQUIRE(array.success());
|
|
|
|
}
|
2015-09-28 22:14:50 +02:00
|
|
|
|
2017-04-18 18:22:24 +02:00
|
|
|
SECTION("InitialSizeIsZero") {
|
|
|
|
REQUIRE(0U == array.size());
|
|
|
|
}
|
2015-09-28 22:14:50 +02:00
|
|
|
|
2017-04-18 18:22:24 +02:00
|
|
|
SECTION("CreateNestedArray") {
|
|
|
|
JsonArray& arr = array.createNestedArray();
|
|
|
|
REQUIRE(&arr == &array[0].as<JsonArray&>());
|
|
|
|
}
|
2015-09-28 22:14:50 +02:00
|
|
|
|
2017-04-18 18:22:24 +02:00
|
|
|
SECTION("CreateNestedObject") {
|
|
|
|
JsonObject& obj = array.createNestedObject();
|
|
|
|
REQUIRE(&obj == &array[0].as<JsonObject&>());
|
|
|
|
}
|
2015-09-28 22:14:50 +02:00
|
|
|
}
|