mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-23 23:37:37 +02:00
Test that JsonObject.size() is increased when values are added
This commit is contained in:
16
tests/JsonObjectTests.cpp
Normal file
16
tests/JsonObjectTests.cpp
Normal file
@ -0,0 +1,16 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include <StaticJsonBuffer.h>
|
||||
#include <JsonValue.h>
|
||||
|
||||
TEST(JsonObjectTests, WhenValueIsAdded_ThenSizeIsIncreasedByOne)
|
||||
{
|
||||
StaticJsonBuffer<42> json;
|
||||
|
||||
JsonObject object = json.createObject();
|
||||
|
||||
object["hello"];
|
||||
EXPECT_EQ(1, object.size());
|
||||
|
||||
object["world"];
|
||||
EXPECT_EQ(2, object.size());
|
||||
}
|
@ -85,6 +85,7 @@
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\third-party\gtest-1.7.0\src\gtest-all.cc" />
|
||||
<ClCompile Include="..\third-party\gtest-1.7.0\src\gtest_main.cc" />
|
||||
<ClCompile Include="JsonObjectTests.cpp" />
|
||||
<ClCompile Include="StaticJsonBufferTests.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -27,5 +27,8 @@
|
||||
<ClCompile Include="StaticJsonBufferTests.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="JsonObjectTests.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
Reference in New Issue
Block a user