forked from bblanchon/ArduinoJson
Added JsonVariant::clear()
This commit is contained in:
27
test/MemberProxy/clear.cpp
Normal file
27
test/MemberProxy/clear.cpp
Normal file
@ -0,0 +1,27 @@
|
||||
// ArduinoJson - arduinojson.org
|
||||
// Copyright Benoit Blanchon 2014-2019
|
||||
// MIT License
|
||||
|
||||
#include <ArduinoJson.h>
|
||||
#include <catch.hpp>
|
||||
|
||||
using namespace ARDUINOJSON_NAMESPACE;
|
||||
|
||||
TEST_CASE("MemberProxy::clear()") {
|
||||
DynamicJsonDocument doc(4096);
|
||||
MemberProxy<JsonDocument&, const char*> mp = doc["hello"];
|
||||
|
||||
SECTION("size goes back to zero") {
|
||||
mp.add(42);
|
||||
mp.clear();
|
||||
|
||||
REQUIRE(mp.size() == 0);
|
||||
}
|
||||
|
||||
SECTION("isNull() return true") {
|
||||
mp.add("hello");
|
||||
mp.clear();
|
||||
|
||||
REQUIRE(mp.isNull() == true);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user