mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-23 23:37:37 +02:00
Test that adding the same value twice doesn't increase the size of the object
This commit is contained in:
@ -13,4 +13,17 @@ TEST(JsonObjectTests, WhenValueIsAdded_ThenSizeIsIncreasedByOne)
|
||||
|
||||
object["world"];
|
||||
EXPECT_EQ(2, object.size());
|
||||
}
|
||||
|
||||
TEST(JsonObjectTests, WhenTheSameValueIsAddedTwice_ThenSizeIsOnlyIncreasedByOne)
|
||||
{
|
||||
StaticJsonBuffer<42> json;
|
||||
|
||||
JsonObject object = json.createObject();
|
||||
|
||||
object["hello"];
|
||||
EXPECT_EQ(1, object.size());
|
||||
|
||||
object["hello"];
|
||||
EXPECT_EQ(1, object.size());
|
||||
}
|
@ -54,4 +54,16 @@ TEST(StaticJsonBuffer, GivenAJsonObject_WhenValuesAreAdded_ThenSizeIsIncreasedBy
|
||||
|
||||
obj["world"];
|
||||
EXPECT_EQ(5, json.size());
|
||||
}
|
||||
|
||||
TEST(StaticJsonBuffer, GivenAJsonObject_WhenSameValuesAreAddedTwice_ThenSizeIsOnlyIncreasedByTwo)
|
||||
{
|
||||
StaticJsonBuffer<42> json;
|
||||
JsonObject obj = json.createObject();
|
||||
|
||||
obj["hello"];
|
||||
EXPECT_EQ(3, json.size());
|
||||
|
||||
obj["hello"];
|
||||
EXPECT_EQ(3, json.size());
|
||||
}
|
Reference in New Issue
Block a user