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:
@ -18,4 +18,9 @@ JsonNode* JsonBuffer::createNode()
|
|||||||
if (!node) return 0;
|
if (!node) return 0;
|
||||||
|
|
||||||
return new (node) JsonNode();
|
return new (node) JsonNode();
|
||||||
|
}
|
||||||
|
|
||||||
|
JsonArray JsonBuffer::parseArray(char const *string)
|
||||||
|
{
|
||||||
|
return JsonArray();
|
||||||
}
|
}
|
@ -27,6 +27,8 @@ public:
|
|||||||
|
|
||||||
JsonValue createValue();
|
JsonValue createValue();
|
||||||
|
|
||||||
|
JsonArray parseArray(char const *string);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void* allocateNode() = 0;
|
virtual void* allocateNode() = 0;
|
||||||
|
|
||||||
|
@ -38,4 +38,5 @@ protected:
|
|||||||
private:
|
private:
|
||||||
JsonNode _buffer[CAPACITY];
|
JsonNode _buffer[CAPACITY];
|
||||||
int _size;
|
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