mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-22 23:07:29 +02:00
Add memoryUsage()
to ElementProxy
and MemberProxy
(fixes #1730)
This commit is contained in:
@ -205,4 +205,26 @@ TEST_CASE("DynamicJsonDocument assignment") {
|
||||
REQUIRE_JSON(doc2, "42");
|
||||
REQUIRE(doc2.capacity() == 4096);
|
||||
}
|
||||
|
||||
SECTION("Assign from MemberProxy") {
|
||||
StaticJsonDocument<200> doc1;
|
||||
doc1["value"] = 42;
|
||||
|
||||
DynamicJsonDocument doc2(4096);
|
||||
doc2 = doc1["value"];
|
||||
|
||||
REQUIRE_JSON(doc2, "42");
|
||||
REQUIRE(doc2.capacity() == 4096);
|
||||
}
|
||||
|
||||
SECTION("Assign from ElementProxy") {
|
||||
StaticJsonDocument<200> doc1;
|
||||
doc1[0] = 42;
|
||||
|
||||
DynamicJsonDocument doc2(4096);
|
||||
doc2 = doc1[0];
|
||||
|
||||
REQUIRE_JSON(doc2, "42");
|
||||
REQUIRE(doc2.capacity() == 4096);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user