mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-16 12:02:14 +02:00
Parse empty array
This commit is contained in:
@ -19,3 +19,8 @@ JsonNode* JsonBuffer::createNode()
|
||||
|
||||
return new (node) JsonNode();
|
||||
}
|
||||
|
||||
JsonArray JsonBuffer::parseArray(char const *string)
|
||||
{
|
||||
return JsonArray();
|
||||
}
|
@ -27,6 +27,8 @@ public:
|
||||
|
||||
JsonValue createValue();
|
||||
|
||||
JsonArray parseArray(char const *string);
|
||||
|
||||
protected:
|
||||
virtual void* allocateNode() = 0;
|
||||
|
||||
|
@ -39,3 +39,4 @@ private:
|
||||
JsonNode _buffer[CAPACITY];
|
||||
int _size;
|
||||
};
|
||||
|
||||
|
15
tests/JsonArray_Parser_Tests.cpp
Normal file
15
tests/JsonArray_Parser_Tests.cpp
Normal file
@ -0,0 +1,15 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include <StaticJsonBuffer.h>
|
||||
|
||||
class JsonArray_Parser_Tests : public testing::Test
|
||||
{
|
||||
protected:
|
||||
StaticJsonBuffer<42> json;
|
||||
};
|
||||
|
||||
TEST_F(JsonArray_Parser_Tests, EmptyArray)
|
||||
{
|
||||
JsonArray array = json.parseArray("[]");
|
||||
|
||||
EXPECT_EQ(0, array.size());
|
||||
}
|
Reference in New Issue
Block a user