#include #include TEST_CASE("nullptr") { DynamicJsonDocument doc(4096); JsonVariant variant = doc.to(); SECTION("JsonVariant == nullptr") { REQUIRE(variant == nullptr); REQUIRE_FALSE(variant != nullptr); } SECTION("JsonVariant != nullptr") { variant.set(42); REQUIRE_FALSE(variant == nullptr); REQUIRE(variant != nullptr); } SECTION("JsonVariant.set(nullptr)") { variant.set(42); variant.set(nullptr); REQUIRE(variant.isNull()); } SECTION("JsonVariant.set(nullptr) with unbound reference") { JsonVariant unboundReference; unboundReference.set(nullptr); REQUIRE(variant.isNull()); } SECTION("JsonVariant.is()") { variant.set(42); REQUIRE(variant.is() == false); variant.clear(); REQUIRE(variant.is() == true); } }