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;
return new (node) JsonNode();
}
JsonArray JsonBuffer::parseArray(char const *string)
{
return JsonArray();
}

View File

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

View File

@ -38,4 +38,5 @@ protected:
private:
JsonNode _buffer[CAPACITY];
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());
}