Line | |
---|
1 | // Copyright Benoit Blanchon 2014-2016
|
---|
2 | // MIT License
|
---|
3 | //
|
---|
4 | // Arduino JSON library
|
---|
5 | // https://github.com/bblanchon/ArduinoJson
|
---|
6 | // If you like this project, please add a star!
|
---|
7 |
|
---|
8 | #include <gtest/gtest.h>
|
---|
9 | #include <ArduinoJson.h>
|
---|
10 |
|
---|
11 | TEST(DynamicJsonBuffer_Object_Tests, GrowsWithObject) {
|
---|
12 | DynamicJsonBuffer json;
|
---|
13 |
|
---|
14 | JsonObject &obj = json.createObject();
|
---|
15 | ASSERT_EQ(JSON_OBJECT_SIZE(0), json.size());
|
---|
16 |
|
---|
17 | obj["hello"] = 1;
|
---|
18 | ASSERT_EQ(JSON_OBJECT_SIZE(1), json.size());
|
---|
19 |
|
---|
20 | obj["world"] = 2;
|
---|
21 | ASSERT_EQ(JSON_OBJECT_SIZE(2), json.size());
|
---|
22 |
|
---|
23 | obj["world"] = 3; // <- same key, should not grow
|
---|
24 | ASSERT_EQ(JSON_OBJECT_SIZE(2), json.size());
|
---|
25 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.