mirror of
				https://github.com/eledio-devices/thirdparty-ArduinoJson.git
				synced 2025-10-31 08:42:39 +01:00 
			
		
		
		
	Renamed unit test classes
This commit is contained in:
		| @@ -13,7 +13,7 @@ using namespace ArduinoJson::Parser; | ||||
| 
 | ||||
| namespace ArduinoJsonParserTests | ||||
| { | ||||
| 	TEST_CLASS(TestGbathreeSample1) | ||||
| 	TEST_CLASS(GbathreeBug) | ||||
| 	{ | ||||
| 		char json[1024]; | ||||
| 		JsonParser<200> parser; | ||||
| @@ -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)); | ||||
|         } | ||||
| 	}; | ||||
| } | ||||
| @@ -13,7 +13,7 @@ using namespace ArduinoJson::Parser; | ||||
| 
 | ||||
| namespace ArduinoJsonParserTests | ||||
| {		 | ||||
| 	TEST_CLASS(TestHashTableExample) | ||||
|     TEST_CLASS(JsonHashTableTests) | ||||
| 	{ | ||||
| 		char json[128]; | ||||
| 		JsonParser<32> parser; | ||||
| @@ -89,10 +89,9 @@ | ||||
|     <ClCompile Include="..\JsonParser\JsonArray.cpp" /> | ||||
|     <ClCompile Include="..\JsonParser\JsonHashTable.cpp" /> | ||||
|     <ClCompile Include="..\JsonParser\JsonObjectBase.cpp" /> | ||||
|     <ClCompile Include="TestArrayExample.cpp" /> | ||||
|     <ClCompile Include="TestArrays.cpp" /> | ||||
|     <ClCompile Include="TestHashTableExample.cpp" /> | ||||
|     <ClCompile Include="TestGbathreeStrings.cpp" /> | ||||
|     <ClCompile Include="JsonArrayTests.cpp" /> | ||||
|     <ClCompile Include="JsonHashTableTests.cpp" /> | ||||
|     <ClCompile Include="GbathreeBug.cpp" /> | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <ClInclude Include="..\JsonParser\jsmn.h" /> | ||||
|   | ||||
| @@ -15,18 +15,6 @@ | ||||
|     </Filter> | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <ClCompile Include="TestHashTableExample.cpp"> | ||||
|       <Filter>Source Files</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="TestArrayExample.cpp"> | ||||
|       <Filter>Source Files</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="TestGbathreeStrings.cpp"> | ||||
|       <Filter>Source Files</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="TestArrays.cpp"> | ||||
|       <Filter>Source Files</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\JsonParser\jsmn.cpp"> | ||||
|       <Filter>Source Files</Filter> | ||||
|     </ClCompile> | ||||
| @@ -39,6 +27,15 @@ | ||||
|     <ClCompile Include="..\JsonParser\JsonObjectBase.cpp"> | ||||
|       <Filter>Source Files</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="JsonArrayTests.cpp"> | ||||
|       <Filter>Source Files</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="GbathreeBug.cpp"> | ||||
|       <Filter>Source Files</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="JsonHashTableTests.cpp"> | ||||
|       <Filter>Source Files</Filter> | ||||
|     </ClCompile> | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <ClInclude Include="..\JsonParser\jsmn.h"> | ||||
|   | ||||
| @@ -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)); | ||||
| 		} | ||||
| 	}; | ||||
| } | ||||
		Reference in New Issue
	
	Block a user