/
nicodim4
/
ArduinoJson
Обзор
Документация
Войти
/
nicodim4
/
ArduinoJson
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
7.x
extras/tests/JsonArrayConst/nesting.cpp
35 строк
754 B
Benoit Blanchon
Update copyright year
06 июл 2026, 19:35
06 июл 2026, 19:35
7823e4a
Код
Авторство
О чём код?
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2026, Benoit BLANCHON // MIT License #include <ArduinoJson.h> #include <catch.hpp> TEST_CASE("JsonArrayConst::nesting()") { JsonDocument doc; JsonArrayConst arr = doc.to<JsonArray>(); SECTION("return 0 if unbound") { JsonArrayConst unbound; REQUIRE(unbound.nesting() == 0); } SECTION("returns 1 for empty array") { REQUIRE(arr.nesting() == 1); } SECTION("returns 1 for flat array") { doc.add("hello"); REQUIRE(arr.nesting() == 1); } SECTION("returns 2 with nested array") { doc.add<JsonArray>(); REQUIRE(arr.nesting() == 2); } SECTION("returns 2 with nested object") { doc.add<JsonObject>(); REQUIRE(arr.nesting() == 2); } }