// ArduinoJson - https://arduinojson.org // Copyright © 2014-2024, Benoit BLANCHON // MIT License #include #include TEST_CASE("JsonDocument::nesting()") { JsonDocument doc; SECTION("return 0 if uninitialized") { REQUIRE(doc.nesting() == 0); } SECTION("returns 0 for string") { JsonVariant var = doc.to(); var.set("hello"); REQUIRE(doc.nesting() == 0); } SECTION("returns 1 for empty object") { doc.to(); REQUIRE(doc.nesting() == 1); } SECTION("returns 1 for empty array") { doc.to(); REQUIRE(doc.nesting() == 1); } }