Benoit Blanchon 11 anni fa
parent
commit
f468db6757
4 ha cambiato i file con 24 aggiunte e 1 eliminazioni
  1. 5 0
      srcs/JsonBuffer.cpp
  2. 2 0
      srcs/JsonBuffer.h
  3. 2 1
      srcs/StaticJsonBuffer.h
  4. 15 0
      tests/JsonArray_Parser_Tests.cpp

+ 5 - 0
srcs/JsonBuffer.cpp

@@ -18,4 +18,9 @@ JsonNode* JsonBuffer::createNode()
     if (!node) return 0;
         
     return new (node) JsonNode();
+}
+
+JsonArray JsonBuffer::parseArray(char const *string)
+{
+    return JsonArray();
 }

+ 2 - 0
srcs/JsonBuffer.h

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

+ 2 - 1
srcs/StaticJsonBuffer.h

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

+ 15 - 0
tests/JsonArray_Parser_Tests.cpp

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