Improved coverage of JsonArray

This commit is contained in:
Benoit Blanchon
2020-02-20 09:18:10 +01:00
parent d8724e0a0b
commit 300323cfd7
2 changed files with 38 additions and 3 deletions

View File

@ -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);
}
}

View File

@ -28,9 +28,25 @@ static void run_iterator_test() {
}
TEST_CASE("JsonArray::begin()/end()") {
SECTION("Non null JsonArray") {
run_iterator_test<JsonArray>();
}
SECTION("Null JsonArray") {
JsonArray array;
REQUIRE(array.begin() == array.end());
}
}
TEST_CASE("JsonArrayConst::begin()/end()") {
SECTION("Non null JsonArrayConst") {
run_iterator_test<JsonArrayConst>();
}
SECTION("Null JsonArrayConst") {
JsonArrayConst array;
REQUIRE(array.begin() == array.end());
}
}