isnull.cpp 462 B

123456789101112131415161718192021
  1. // ArduinoJson - https://arduinojson.org
  2. // Copyright © 2014-2024, Benoit BLANCHON
  3. // MIT License
  4. #include <ArduinoJson.h>
  5. #include <catch.hpp>
  6. TEST_CASE("JsonVariantConst::isNull()") {
  7. JsonDocument doc;
  8. JsonVariantConst variant = doc.to<JsonVariant>();
  9. SECTION("returns true when undefined") {
  10. REQUIRE(variant.isNull() == true);
  11. }
  12. SECTION("returns false if value is integer") {
  13. doc.set(42);
  14. REQUIRE(variant.isNull() == false);
  15. }
  16. }