Test that adding values to the JsonObject increase the size of the buffer

This commit is contained in:
Benoit Blanchon
2014-09-27 12:16:20 +02:00
parent 4d4119e589
commit 166bdd6919
8 changed files with 74 additions and 17 deletions

View File

@ -1,5 +1,6 @@
#include <gtest/gtest.h>
#include <StaticJsonBuffer.h>
#include <JsonValue.h>
TEST(StaticJsonBuffer, CapacityMatchTemplateParameter)
{
@ -35,10 +36,22 @@ TEST(StaticJsonBuffer, GivenBufferIsFull_WhenCreateObjectIsCalled_ThenSizeDoesNo
EXPECT_EQ(1, json.size());
}
TEST(StaticJsonBuffer, WhenWhenCreateObjectIsCalled_ThenAnEmptyJsonObjectIsReturned)
TEST(StaticJsonBuffer, WhenCreateObjectIsCalled_ThenAnEmptyJsonObjectIsReturned)
{
StaticJsonBuffer<42> json;
JsonObject obj = json.createObject();
EXPECT_EQ(0, obj.size());
}
TEST(StaticJsonBuffer, GivenAJsonObject_WhenValuesAreAdded_ThenSizeIsIncreasedByTwo)
{
StaticJsonBuffer<42> json;
JsonObject obj = json.createObject();
obj["hello"];
EXPECT_EQ(3, json.size());
obj["world"];
EXPECT_EQ(5, json.size());
}