mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-17 20:42:24 +02:00
Generator: added a test of a full array
This commit is contained in:
@ -16,7 +16,7 @@ public:
|
|||||||
|
|
||||||
void add(const char* data)
|
void add(const char* data)
|
||||||
{
|
{
|
||||||
if (itemCount <= N)
|
if (itemCount < N)
|
||||||
items[itemCount++] = data;
|
items[itemCount++] = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ namespace JsonGeneratorTests
|
|||||||
{
|
{
|
||||||
TEST_CLASS(JsonArrayTests)
|
TEST_CLASS(JsonArrayTests)
|
||||||
{
|
{
|
||||||
JsonArray<3> arr;
|
JsonArray<2> arr;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -31,6 +31,15 @@ namespace JsonGeneratorTests
|
|||||||
AssertJsonIs("['hello','world']");
|
AssertJsonIs("['hello','world']");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_METHOD(OverCapacity)
|
||||||
|
{
|
||||||
|
arr.add("hello");
|
||||||
|
arr.add("world");
|
||||||
|
arr.add("lost");
|
||||||
|
|
||||||
|
AssertJsonIs("['hello','world']");
|
||||||
|
}
|
||||||
|
|
||||||
void AssertJsonIs(const char* expected)
|
void AssertJsonIs(const char* expected)
|
||||||
{
|
{
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
|
Reference in New Issue
Block a user