mirror of
				https://github.com/eledio-devices/thirdparty-ArduinoJson.git
				synced 2025-10-31 08:42:39 +01:00 
			
		
		
		
	* Added DynamicJsonArray and StaticJsonArray * Added DynamicJsonObject and StaticJsonObject * Added DynamicJsonVariant and StaticJsonVariant * Added deserializeJson() * Removed JsonBuffer::parseArray(), parseObject() and parse() * Removed JsonBuffer::createArray() and createObject()
		
			
				
	
	
		
			35 lines
		
	
	
		
			701 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			35 lines
		
	
	
		
			701 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| // ArduinoJson - arduinojson.org
 | |
| // Copyright Benoit Blanchon 2014-2018
 | |
| // MIT License
 | |
| 
 | |
| #include <ArduinoJson.h>
 | |
| #include <catch.hpp>
 | |
| 
 | |
| TEST_CASE("JsonArray::size()") {
 | |
|   DynamicJsonArray _array;
 | |
| 
 | |
|   SECTION("increases after add()") {
 | |
|     _array.add("hello");
 | |
|     REQUIRE(1U == _array.size());
 | |
| 
 | |
|     _array.add("world");
 | |
|     REQUIRE(2U == _array.size());
 | |
|   }
 | |
| 
 | |
|   SECTION("remains the same after set()") {
 | |
|     _array.add("hello");
 | |
|     REQUIRE(1U == _array.size());
 | |
| 
 | |
|     _array.set(0, "hello");
 | |
|     REQUIRE(1U == _array.size());
 | |
|   }
 | |
| 
 | |
|   SECTION("remains the same after assigment") {
 | |
|     _array.add("hello");
 | |
|     REQUIRE(1U == _array.size());
 | |
| 
 | |
|     _array[0] = "hello";
 | |
|     REQUIRE(1U == _array.size());
 | |
|   }
 | |
| }
 |