Files

28 lines
553 B
C++
Raw Permalink Normal View History

2024-01-08 19:10:29 +01:00
// ArduinoJson - https://arduinojson.org
2025-02-24 15:18:26 +01:00
// Copyright © 2014-2025, Benoit BLANCHON
2024-01-08 19:10:29 +01:00
// MIT License
#include <ArduinoJson.h>
2026-07-06 15:12:32 +02:00
#include <doctest.h>
2024-01-08 19:10:29 +01:00
TEST_CASE("JsonArrayConst::size()") {
JsonDocument doc;
JsonArrayConst array = doc.to<JsonArray>();
2026-07-06 15:12:32 +02:00
SUBCASE("returns 0 if unbound") {
2024-01-08 19:10:29 +01:00
JsonArrayConst unbound;
REQUIRE(0U == unbound.size());
}
2026-07-06 15:12:32 +02:00
SUBCASE("returns 0 is empty") {
2024-01-08 19:10:29 +01:00
REQUIRE(0U == array.size());
}
2026-07-06 15:12:32 +02:00
SUBCASE("return number of elements") {
2024-01-08 19:10:29 +01:00
doc.add("hello");
doc.add("world");
REQUIRE(2U == array.size());
}
}