diff --git a/JsonGeneratorTests/JsonArrayTests.cpp b/JsonGeneratorTests/JsonArrayTests.cpp
index 8b25593a..66bb6b32 100644
--- a/JsonGeneratorTests/JsonArrayTests.cpp
+++ b/JsonGeneratorTests/JsonArrayTests.cpp
@@ -11,23 +11,23 @@ namespace JsonGeneratorTests
public:
- TEST_METHOD(EmptyArray)
+ TEST_METHOD(Empty)
{
- AssertJsonIs("[]");
+ assertJsonIs("[]");
}
TEST_METHOD(AddNull)
{
arr.add((char*)0);
- AssertJsonIs("[null]");
+ assertJsonIs("[null]");
}
TEST_METHOD(AddOneString)
{
arr.add("hello");
- AssertJsonIs("[\"hello\"]");
+ assertJsonIs("[\"hello\"]");
}
TEST_METHOD(AddTwoStrings)
@@ -35,7 +35,7 @@ namespace JsonGeneratorTests
arr.add("hello");
arr.add("world");
- AssertJsonIs("[\"hello\",\"world\"]");
+ assertJsonIs("[\"hello\",\"world\"]");
}
TEST_METHOD(AddOneStringOverCapacity)
@@ -44,14 +44,14 @@ namespace JsonGeneratorTests
arr.add("world");
arr.add("lost");
- AssertJsonIs("[\"hello\",\"world\"]");
+ assertJsonIs("[\"hello\",\"world\"]");
}
TEST_METHOD(AddOneNumber)
{
arr.add(3.14);
- AssertJsonIs("[3.14]");
+ assertJsonIs("[3.14]");
}
TEST_METHOD(AddTwoNumbers)
@@ -59,7 +59,7 @@ namespace JsonGeneratorTests
arr.add(3.14);
arr.add(2.72);
- AssertJsonIs("[3.14,2.72]");
+ assertJsonIs("[3.14,2.72]");
}
TEST_METHOD(AddOneNumberOverCapacity)
@@ -68,21 +68,21 @@ namespace JsonGeneratorTests
arr.add(2.72);
arr.add(1.41);
- AssertJsonIs("[3.14,2.72]");
+ assertJsonIs("[3.14,2.72]");
}
TEST_METHOD(AddTrue)
{
arr.add(true);
- AssertJsonIs("[true]");
+ assertJsonIs("[true]");
}
TEST_METHOD(AddFalse)
{
arr.add(false);
- AssertJsonIs("[false]");
+ assertJsonIs("[false]");
}
TEST_METHOD(AddTwoBooleans)
@@ -90,7 +90,7 @@ namespace JsonGeneratorTests
arr.add(false);
arr.add(true);
- AssertJsonIs("[false,true]");
+ assertJsonIs("[false,true]");
}
TEST_METHOD(AddOneBooleanOverCapacity)
@@ -99,7 +99,7 @@ namespace JsonGeneratorTests
arr.add(true);
arr.add(false);
- AssertJsonIs("[false,true]");
+ assertJsonIs("[false,true]");
}
TEST_METHOD(AddOneEmptyNestedArray)
@@ -108,7 +108,7 @@ namespace JsonGeneratorTests
arr.add(nestedArray);
- AssertJsonIs("[[]]");
+ assertJsonIs("[[]]");
}
TEST_METHOD(AddOneNestedArrayWithOneItem)
@@ -118,10 +118,12 @@ namespace JsonGeneratorTests
arr.add(nestedArray);
- AssertJsonIs("[[3.14]]");
+ assertJsonIs("[[3.14]]");
}
- void AssertJsonIs(const char* expected)
+ private:
+
+ void assertJsonIs(const char* expected)
{
char buffer[256];
diff --git a/JsonGeneratorTests/JsonGeneratorTests.vcxproj b/JsonGeneratorTests/JsonGeneratorTests.vcxproj
index ab8b61e7..16a0860d 100644
--- a/JsonGeneratorTests/JsonGeneratorTests.vcxproj
+++ b/JsonGeneratorTests/JsonGeneratorTests.vcxproj
@@ -83,6 +83,7 @@
+
@@ -90,6 +91,7 @@
+
diff --git a/JsonGeneratorTests/JsonGeneratorTests.vcxproj.filters b/JsonGeneratorTests/JsonGeneratorTests.vcxproj.filters
index 80c5b585..0962d62c 100644
--- a/JsonGeneratorTests/JsonGeneratorTests.vcxproj.filters
+++ b/JsonGeneratorTests/JsonGeneratorTests.vcxproj.filters
@@ -30,6 +30,9 @@
Source Files
+
+ Source Files
+
@@ -41,5 +44,8 @@
Header Files
+
+ Header Files
+
\ No newline at end of file
diff --git a/JsonGeneratorTests/JsonHashTable.h b/JsonGeneratorTests/JsonHashTable.h
new file mode 100644
index 00000000..5dc4b2ef
--- /dev/null
+++ b/JsonGeneratorTests/JsonHashTable.h
@@ -0,0 +1,38 @@
+/*
+ * Arduino JSON library
+ * Benoit Blanchon 2014 - MIT License
+ */
+
+#pragma once
+
+#include "JsonObjectBase.h"
+
+template
+class JsonHashTable : public JsonObjectBase
+{
+public:
+
+ using JsonObjectBase::writeTo;
+
+private:
+
+ /* struct KeyValuePair
+ {
+ const char* key;
+ ObjectContainer value;
+ };*/
+
+ virtual void writeTo(StringBuilder& sb)
+ {
+ sb.append("{");
+
+ /*for (int i = 0; i < itemCount; i++)
+ {
+ if (i>0) sb.append(",");
+ writeObjectTo(items[i], sb);
+ }*/
+
+ sb.append("}");
+ }
+};
+
diff --git a/JsonGeneratorTests/JsonHashTableTests.cpp b/JsonGeneratorTests/JsonHashTableTests.cpp
new file mode 100644
index 00000000..8e7c3e44
--- /dev/null
+++ b/JsonGeneratorTests/JsonHashTableTests.cpp
@@ -0,0 +1,30 @@
+#include "CppUnitTest.h"
+#include "JsonHashTable.h"
+
+using namespace Microsoft::VisualStudio::CppUnitTestFramework;
+
+namespace JsonGeneratorTests
+{
+ TEST_CLASS(JsonHashTableTests)
+ {
+ JsonHashTable<2> hash;
+
+ public:
+
+ TEST_METHOD(Empty)
+ {
+ assertJsonIs("{}");
+ }
+
+ private:
+
+ void assertJsonIs(const char* expected)
+ {
+ char buffer[256];
+
+ hash.writeTo(buffer, sizeof(buffer));
+
+ Assert::AreEqual(expected, buffer);
+ }
+ };
+}
\ No newline at end of file