Parse empty array

This commit is contained in:
Benoit Blanchon
2014-10-14 17:16:21 +02:00
parent c7dcf864cc
commit f468db6757
4 changed files with 24 additions and 1 deletions

View File

@ -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();
} }

View File

@ -27,6 +27,8 @@ public:
JsonValue createValue(); JsonValue createValue();
JsonArray parseArray(char const *string);
protected: protected:
virtual void* allocateNode() = 0; virtual void* allocateNode() = 0;

View File

@ -38,4 +38,5 @@ protected:
private: private:
JsonNode _buffer[CAPACITY]; JsonNode _buffer[CAPACITY];
int _size; int _size;
}; };

View 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());
}