mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-13 18:46:35 +02:00
29 lines
528 B
C++
29 lines
528 B
C++
// ArduinoJson - arduinojson.org
|
|
// Copyright Benoit Blanchon 2014-2020
|
|
// MIT License
|
|
|
|
#include <ArduinoJson.h>
|
|
#include <catch.hpp>
|
|
|
|
using namespace ARDUINOJSON_NAMESPACE;
|
|
|
|
TEST_CASE("ElementProxy::clear()") {
|
|
DynamicJsonDocument doc(4096);
|
|
doc.addElement();
|
|
ElementProxy<JsonDocument&> ep = doc[0];
|
|
|
|
SECTION("size goes back to zero") {
|
|
ep.add(42);
|
|
ep.clear();
|
|
|
|
REQUIRE(ep.size() == 0);
|
|
}
|
|
|
|
SECTION("isNull() return true") {
|
|
ep.add("hello");
|
|
ep.clear();
|
|
|
|
REQUIRE(ep.isNull() == true);
|
|
}
|
|
}
|