mirror of
				https://github.com/eledio-devices/thirdparty-ArduinoJson.git
				synced 2025-10-31 16:14:11 +01:00 
			
		
		
		
	Added a failng test
This commit is contained in:
		| @@ -59,6 +59,11 @@ namespace ArduinoJson | ||||
|                 content.asDouble = value; | ||||
|             } | ||||
|  | ||||
|             operator const char*() | ||||
|             { | ||||
|                 return ""; | ||||
|             } | ||||
|  | ||||
|             size_t printTo(Print& p) const | ||||
|             { | ||||
|                 // handmade polymorphism | ||||
|   | ||||
| @@ -86,6 +86,7 @@ | ||||
|   <ItemGroup> | ||||
|     <ClCompile Include="EscapedStringTests.cpp" /> | ||||
|     <ClCompile Include="JsonArrayTests.cpp" /> | ||||
|     <ClCompile Include="JsonObject_Indexer_Tests.cpp" /> | ||||
|     <ClCompile Include="JsonObject_PrintTo_Tests.cpp" /> | ||||
|     <ClCompile Include="JsonValueTests.cpp" /> | ||||
|     <ClCompile Include="StringBuilderTests.cpp" /> | ||||
|   | ||||
| @@ -30,5 +30,8 @@ | ||||
|     <ClCompile Include="JsonObject_PrintTo_Tests.cpp"> | ||||
|       <Filter>Source Files</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="JsonObject_Indexer_Tests.cpp"> | ||||
|       <Filter>Source Files</Filter> | ||||
|     </ClCompile> | ||||
|   </ItemGroup> | ||||
| </Project> | ||||
							
								
								
									
										42
									
								
								JsonGeneratorTests/JsonObject_Indexer_Tests.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								JsonGeneratorTests/JsonObject_Indexer_Tests.cpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,42 @@ | ||||
| /* | ||||
| * Arduino JSON library | ||||
| * Benoit Blanchon 2014 - MIT License | ||||
| */ | ||||
|  | ||||
| #include "CppUnitTest.h" | ||||
| #include "JsonArray.h" | ||||
| #include "JsonObject.h" | ||||
|  | ||||
| using namespace Microsoft::VisualStudio::CppUnitTestFramework; | ||||
| using namespace ArduinoJson::Generator; | ||||
|  | ||||
| namespace JsonGeneratorTests | ||||
| { | ||||
|     TEST_CLASS(JsonObject_Indexer_Tests) | ||||
|     { | ||||
|         JsonObject<2> object; | ||||
|  | ||||
|     public: | ||||
|  | ||||
|     /*    TEST_METHOD(Empty) | ||||
|         { | ||||
|             mustNotContain("key"); | ||||
|         }*/ | ||||
|  | ||||
|         TEST_METHOD(OneString) | ||||
|         { | ||||
|             object["key"] = "value"; | ||||
|  | ||||
|             mustContain("key", "value"); | ||||
|         } | ||||
|  | ||||
|  | ||||
|     private: | ||||
|  | ||||
|         void mustContain(const char* key, const char* expected) | ||||
|         { | ||||
|             auto actual = (const char*) object[key]; | ||||
|             Assert::AreEqual(expected, actual); | ||||
|         } | ||||
|     }; | ||||
| } | ||||
		Reference in New Issue
	
	Block a user