Test that adding the same value twice doesn't increase the size of the object

This commit is contained in:
Benoit Blanchon committed 2014-09-27 14:43:19 +02:00
1 parent 166bdd6919
commit a2fc188526
10 files changed
+146 -32

No files matched your search

+12
View File
@@ -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());
}