2018-11-03 20:21:33 +00:00
|
|
|
// ArduinoJson - arduinojson.org
|
|
|
|
// Copyright Benoit Blanchon 2014-2018
|
|
|
|
// MIT License
|
|
|
|
|
|
|
|
#include <ArduinoJson.h>
|
|
|
|
#include <catch.hpp>
|
|
|
|
|
|
|
|
TEST_CASE("JsonVariant undefined") {
|
|
|
|
JsonVariant variant;
|
|
|
|
|
2018-11-13 14:50:48 +00:00
|
|
|
SECTION("as<long>()") {
|
2018-11-03 20:21:33 +00:00
|
|
|
REQUIRE(0 == variant.as<long>());
|
|
|
|
}
|
|
|
|
|
2018-11-13 14:50:48 +00:00
|
|
|
SECTION("as<unsigned>()") {
|
2018-11-03 20:21:33 +00:00
|
|
|
REQUIRE(0 == variant.as<unsigned>());
|
|
|
|
}
|
|
|
|
|
2018-11-13 14:50:48 +00:00
|
|
|
SECTION("as<char*>()") {
|
2018-11-03 20:21:33 +00:00
|
|
|
REQUIRE(0 == variant.as<char*>());
|
|
|
|
}
|
|
|
|
|
2018-11-13 14:50:48 +00:00
|
|
|
SECTION("as<double>()") {
|
2018-11-03 20:21:33 +00:00
|
|
|
REQUIRE(0 == variant.as<double>());
|
|
|
|
}
|
|
|
|
|
2018-11-13 14:50:48 +00:00
|
|
|
SECTION("as<bool>()") {
|
2018-11-03 20:21:33 +00:00
|
|
|
REQUIRE(false == variant.as<bool>());
|
|
|
|
}
|
|
|
|
|
2018-11-13 14:50:48 +00:00
|
|
|
SECTION("as<JsonArray>()") {
|
|
|
|
REQUIRE(variant.as<JsonArray>().isNull());
|
2018-11-03 20:21:33 +00:00
|
|
|
}
|
|
|
|
|
2018-11-13 14:50:48 +00:00
|
|
|
SECTION("as<JsonObject>()") {
|
|
|
|
REQUIRE(variant.as<JsonObject>().isNull());
|
2018-11-03 20:21:33 +00:00
|
|
|
}
|
|
|
|
}
|