2017-11-07 20:42:50 +01:00
|
|
|
// ArduinoJson - arduinojson.org
|
2018-01-05 09:20:01 +01:00
|
|
|
// Copyright Benoit Blanchon 2014-2018
|
2014-11-04 13:07:14 +01:00
|
|
|
// MIT License
|
|
|
|
|
2014-11-11 16:54:46 +01:00
|
|
|
#include <ArduinoJson.h>
|
2017-04-18 18:22:24 +02:00
|
|
|
#include <catch.hpp>
|
2014-11-04 13:07:14 +01:00
|
|
|
|
2017-04-18 18:22:24 +02:00
|
|
|
TEST_CASE("JsonVariant undefined") {
|
2014-11-04 13:07:14 +01:00
|
|
|
JsonVariant variant;
|
|
|
|
|
2018-09-11 16:05:56 +02:00
|
|
|
SECTION("as<long>()") {
|
2017-04-18 18:22:24 +02:00
|
|
|
REQUIRE(0 == variant.as<long>());
|
|
|
|
}
|
2014-11-04 13:07:14 +01:00
|
|
|
|
2018-09-11 16:05:56 +02:00
|
|
|
SECTION("as<unsigned>()") {
|
2017-04-18 18:22:24 +02:00
|
|
|
REQUIRE(0 == variant.as<unsigned>());
|
|
|
|
}
|
2016-04-30 09:47:53 +02:00
|
|
|
|
2018-09-11 16:05:56 +02:00
|
|
|
SECTION("as<char*>()") {
|
2017-04-18 18:22:24 +02:00
|
|
|
REQUIRE(0 == variant.as<char*>());
|
|
|
|
}
|
2014-11-04 13:07:14 +01:00
|
|
|
|
2018-09-11 16:05:56 +02:00
|
|
|
SECTION("as<double>()") {
|
2017-04-18 18:22:24 +02:00
|
|
|
REQUIRE(0 == variant.as<double>());
|
|
|
|
}
|
2014-11-04 13:07:14 +01:00
|
|
|
|
2018-09-11 16:05:56 +02:00
|
|
|
SECTION("as<bool>()") {
|
2017-04-18 18:22:24 +02:00
|
|
|
REQUIRE(false == variant.as<bool>());
|
|
|
|
}
|
2014-11-04 13:07:14 +01:00
|
|
|
|
2018-09-11 16:05:56 +02:00
|
|
|
SECTION("as<JsonArray>()") {
|
|
|
|
REQUIRE(variant.as<JsonArray>().isNull());
|
2017-04-18 18:22:24 +02:00
|
|
|
}
|
2015-05-25 15:38:58 +02:00
|
|
|
|
2018-09-11 16:05:56 +02:00
|
|
|
SECTION("as<JsonObject>()") {
|
|
|
|
REQUIRE(variant.as<JsonObject>().isNull());
|
2017-04-18 18:22:24 +02:00
|
|
|
}
|
2014-11-04 13:07:14 +01:00
|
|
|
}
|