// ArduinoJson - https://arduinojson.org // Copyright Benoit Blanchon 2014-2021 // MIT License #include #include TEST_CASE("JsonVariant undefined") { JsonVariant variant; SECTION("as()") { SECTION("long") { REQUIRE(variant.as() == 0); } SECTION("unsigned") { REQUIRE(variant.as() == 0); } SECTION("const char*") { REQUIRE(variant.as() == 0); } SECTION("double") { REQUIRE(variant.as() == 0); } SECTION("bool") { REQUIRE(variant.as() == false); } SECTION("JsonArray") { REQUIRE(variant.as().isNull()); } SECTION("JsonObject") { REQUIRE(variant.as().isNull()); } } SECTION("is()") { SECTION("long") { REQUIRE(variant.is() == false); } SECTION("unsigned") { REQUIRE(variant.is() == false); } SECTION("const char*") { REQUIRE(variant.is() == false); } SECTION("double") { REQUIRE(variant.is() == false); } SECTION("bool") { REQUIRE(variant.is() == false); } SECTION("JsonArray") { REQUIRE(variant.is() == false); } SECTION("JsonObject") { REQUIRE(variant.is() == false); } } SECTION("set()") { SECTION("long") { REQUIRE(variant.set(42L) == false); } SECTION("unsigned") { REQUIRE(variant.set(42U) == false); } SECTION("const char*") { REQUIRE(variant.set("42") == false); } SECTION("Serialized") { REQUIRE(variant.set(serialized("42")) == false); } SECTION("double") { REQUIRE(variant.set(42.0) == false); } SECTION("bool") { REQUIRE(variant.set(true) == false); } } }