diff --git a/JsonParserTests/TestGbathreeStrings.cpp b/JsonParserTests/GbathreeBug.cpp similarity index 95% rename from JsonParserTests/TestGbathreeStrings.cpp rename to JsonParserTests/GbathreeBug.cpp index d7d7f38d..8499f576 100644 --- a/JsonParserTests/TestGbathreeStrings.cpp +++ b/JsonParserTests/GbathreeBug.cpp @@ -13,7 +13,7 @@ using namespace ArduinoJson::Parser; namespace ArduinoJsonParserTests { - TEST_CLASS(TestGbathreeSample1) + TEST_CLASS(GbathreeBug) { char json[1024]; JsonParser<200> parser; diff --git a/JsonParserTests/TestArrays.cpp b/JsonParserTests/JsonArrayTests.cpp similarity index 76% rename from JsonParserTests/TestArrays.cpp rename to JsonParserTests/JsonArrayTests.cpp index df49c323..32453c90 100644 --- a/JsonParserTests/TestArrays.cpp +++ b/JsonParserTests/JsonArrayTests.cpp @@ -11,7 +11,7 @@ using namespace ArduinoJson::Parser; namespace ArduinoJsonParserTests { - TEST_CLASS(TestArrays) + TEST_CLASS(JsonArrayTests) { JsonParser<32> parser; @@ -143,5 +143,25 @@ namespace ArduinoJsonParserTests Assert::IsTrue(arrayB.success()); Assert::AreEqual(2, arrayB.getLength()); } + + TEST_METHOD(MatrixOfDoubles) + { + char json[] = "[[1.2,3.4],[5.6,7.8]]"; + + JsonArray array = parser.parseArray(json); + Assert::IsTrue(array.success()); + + Assert::AreEqual(2, array.getLength()); + + JsonArray innerArray0 = array.getArray(0); + Assert::AreEqual(2, innerArray0.getLength()); + Assert::AreEqual(1.2, innerArray0.getDouble(0)); + Assert::AreEqual(3.4, innerArray0.getDouble(1)); + + JsonArray innerArray1 = array.getArray(1); + Assert::AreEqual(2, innerArray1.getLength()); + Assert::AreEqual(5.6, innerArray1.getDouble(0)); + Assert::AreEqual(7.8, innerArray1.getDouble(1)); + } }; } \ No newline at end of file diff --git a/JsonParserTests/TestHashTableExample.cpp b/JsonParserTests/JsonHashTableTests.cpp similarity index 97% rename from JsonParserTests/TestHashTableExample.cpp rename to JsonParserTests/JsonHashTableTests.cpp index 9aba8470..4fd9fb0f 100644 --- a/JsonParserTests/TestHashTableExample.cpp +++ b/JsonParserTests/JsonHashTableTests.cpp @@ -13,7 +13,7 @@ using namespace ArduinoJson::Parser; namespace ArduinoJsonParserTests { - TEST_CLASS(TestHashTableExample) + TEST_CLASS(JsonHashTableTests) { char json[128]; JsonParser<32> parser; diff --git a/JsonParserTests/JsonParserTests.vcxproj b/JsonParserTests/JsonParserTests.vcxproj index 857e4ae9..d30f231e 100644 --- a/JsonParserTests/JsonParserTests.vcxproj +++ b/JsonParserTests/JsonParserTests.vcxproj @@ -89,10 +89,9 @@ - - - - + + + diff --git a/JsonParserTests/JsonParserTests.vcxproj.filters b/JsonParserTests/JsonParserTests.vcxproj.filters index 95c497e2..4e3dedd3 100644 --- a/JsonParserTests/JsonParserTests.vcxproj.filters +++ b/JsonParserTests/JsonParserTests.vcxproj.filters @@ -15,18 +15,6 @@ - - Source Files - - - Source Files - - - Source Files - - - Source Files - Source Files @@ -39,6 +27,15 @@ Source Files + + Source Files + + + Source Files + + + Source Files + diff --git a/JsonParserTests/TestArrayExample.cpp b/JsonParserTests/TestArrayExample.cpp deleted file mode 100644 index 976a3461..00000000 --- a/JsonParserTests/TestArrayExample.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* -* Arduino JSON library -* Benoit Blanchon 2014 - MIT License -*/ - -#include "CppUnitTest.h" -#include "JsonParser.h" - -using namespace Microsoft::VisualStudio::CppUnitTestFramework; -using namespace ArduinoJson::Parser; - -namespace ArduinoJsonParserTests -{ - TEST_CLASS(TestArrayExample) - { - char json[128]; - JsonParser<32> parser; - JsonArray array; - - public: - - TEST_METHOD_INITIALIZE(Initialize) - { - strcpy(json, "[[1.2,3.4],[5.6,7.8]]"); - array = parser.parseArray(json); - } - - TEST_METHOD(Array_Success_ReturnsTrue) - { - Assert::IsTrue(array.success()); - } - - TEST_METHOD(Array_GetLength_Returns2) - { - Assert::AreEqual(2, array.getLength()); - } - - TEST_METHOD(Array_GetArray0_ReturnsInnerArray0) - { - JsonArray innerArray = array.getArray(0); - - Assert::AreEqual(2, innerArray.getLength()); - Assert::AreEqual(1.2, innerArray.getDouble(0)); - Assert::AreEqual(3.4, innerArray.getDouble(1)); - } - - TEST_METHOD(Array_GetArray1_ReturnsInnerArray1) - { - JsonArray innerArray = array.getArray(1); - - Assert::AreEqual(2, innerArray.getLength()); - Assert::AreEqual(5.6, innerArray.getDouble(0)); - Assert::AreEqual(7.8, innerArray.getDouble(1)); - } - }; -} \ No newline at end of file