mirror of
				https://github.com/eledio-devices/thirdparty-ArduinoJson.git
				synced 2025-10-31 08:42:39 +01:00 
			
		
		
		
	Improved coverage of JsonArray
This commit is contained in:
		| @@ -31,7 +31,7 @@ TEST_CASE("JsonArray::operator==()") { | ||||
|     REQUIRE_FALSE(array1c == array2c); | ||||
|   } | ||||
|  | ||||
|   SECTION("should return false when RKS has more elements") { | ||||
|   SECTION("should return false when RHS has more elements") { | ||||
|     array1.add(1); | ||||
|     array2.add(1); | ||||
|     array2.add(2); | ||||
| @@ -47,4 +47,23 @@ TEST_CASE("JsonArray::operator==()") { | ||||
|     REQUIRE(array1 == array2); | ||||
|     REQUIRE(array1c == array2c); | ||||
|   } | ||||
|  | ||||
|   SECTION("should return false when RHS is null") { | ||||
|     JsonArray null; | ||||
|  | ||||
|     REQUIRE_FALSE(array1 == null); | ||||
|   } | ||||
|  | ||||
|   SECTION("should return false when LHS is null") { | ||||
|     JsonArray null; | ||||
|  | ||||
|     REQUIRE_FALSE(null == array1); | ||||
|   } | ||||
|  | ||||
|   SECTION("should return true when both are null") { | ||||
|     JsonArray null1; | ||||
|     JsonArray null2; | ||||
|  | ||||
|     REQUIRE(null1 == null2); | ||||
|   } | ||||
| } | ||||
|   | ||||
| @@ -28,9 +28,25 @@ static void run_iterator_test() { | ||||
| } | ||||
|  | ||||
| TEST_CASE("JsonArray::begin()/end()") { | ||||
|   run_iterator_test<JsonArray>(); | ||||
|   SECTION("Non null JsonArray") { | ||||
|     run_iterator_test<JsonArray>(); | ||||
|   } | ||||
|  | ||||
|   SECTION("Null JsonArray") { | ||||
|     JsonArray array; | ||||
|  | ||||
|     REQUIRE(array.begin() == array.end()); | ||||
|   } | ||||
| } | ||||
|  | ||||
| TEST_CASE("JsonArrayConst::begin()/end()") { | ||||
|   run_iterator_test<JsonArrayConst>(); | ||||
|   SECTION("Non null JsonArrayConst") { | ||||
|     run_iterator_test<JsonArrayConst>(); | ||||
|   } | ||||
|  | ||||
|   SECTION("Null JsonArrayConst") { | ||||
|     JsonArrayConst array; | ||||
|  | ||||
|     REQUIRE(array.begin() == array.end()); | ||||
|   } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user