mirror of
				https://github.com/eledio-devices/thirdparty-ArduinoJson.git
				synced 2025-10-31 16:14:11 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			27 lines
		
	
	
		
			516 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			27 lines
		
	
	
		
			516 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| // ArduinoJson - arduinojson.org
 | |
| // Copyright Benoit Blanchon 2014-2020
 | |
| // MIT License
 | |
| 
 | |
| #include <ArduinoJson.h>
 | |
| #include <catch.hpp>
 | |
| 
 | |
| using namespace ARDUINOJSON_NAMESPACE;
 | |
| 
 | |
| TEST_CASE("ElementProxy::add()") {
 | |
|   DynamicJsonDocument doc(4096);
 | |
|   doc.addElement();
 | |
|   ElementProxy<JsonDocument&> ep = doc[0];
 | |
| 
 | |
|   SECTION("add(int)") {
 | |
|     ep.add(42);
 | |
| 
 | |
|     REQUIRE(doc.as<std::string>() == "[[42]]");
 | |
|   }
 | |
| 
 | |
|   SECTION("add(const char*)") {
 | |
|     ep.add("world");
 | |
| 
 | |
|     REQUIRE(doc.as<std::string>() == "[[\"world\"]]");
 | |
|   }
 | |
| }
 |