Update ArduinoJSON, esp-nimble-cpp, Arduino Core, ESP-IDF (#448)
* ArduinoJSON 7.1.0 * Update nimble and arduino core * Update nuki_ble
This commit is contained in:
@@ -5,6 +5,8 @@
|
||||
#include <ArduinoJson.h>
|
||||
#include <catch.hpp>
|
||||
|
||||
#include "Literals.hpp"
|
||||
|
||||
TEST_CASE("JsonVariantConst::operator[]") {
|
||||
JsonDocument doc;
|
||||
JsonVariantConst var = doc.to<JsonVariant>();
|
||||
@@ -27,13 +29,23 @@ TEST_CASE("JsonVariantConst::operator[]") {
|
||||
array.add("A");
|
||||
array.add("B");
|
||||
|
||||
REQUIRE(std::string("A") == var[0]);
|
||||
REQUIRE(std::string("B") == var[1]);
|
||||
REQUIRE(std::string("A") ==
|
||||
var[static_cast<unsigned char>(0)]); // issue #381
|
||||
REQUIRE(var[666].isNull());
|
||||
REQUIRE(var[3].isNull());
|
||||
REQUIRE(var["0"].isNull());
|
||||
SECTION("int") {
|
||||
REQUIRE("A"_s == var[0]);
|
||||
REQUIRE("B"_s == var[1]);
|
||||
REQUIRE("A"_s == var[static_cast<unsigned char>(0)]); // issue #381
|
||||
REQUIRE(var[666].isNull());
|
||||
REQUIRE(var[3].isNull());
|
||||
}
|
||||
|
||||
SECTION("const char*") {
|
||||
REQUIRE(var["0"].isNull());
|
||||
}
|
||||
|
||||
SECTION("JsonVariant") {
|
||||
array.add(1);
|
||||
REQUIRE(var[var[2]] == "B"_s);
|
||||
REQUIRE(var[var[3]].isNull());
|
||||
}
|
||||
}
|
||||
|
||||
SECTION("object") {
|
||||
@@ -42,16 +54,16 @@ TEST_CASE("JsonVariantConst::operator[]") {
|
||||
object["b"] = "B";
|
||||
|
||||
SECTION("supports const char*") {
|
||||
REQUIRE(std::string("A") == var["a"]);
|
||||
REQUIRE(std::string("B") == var["b"]);
|
||||
REQUIRE("A"_s == var["a"]);
|
||||
REQUIRE("B"_s == var["b"]);
|
||||
REQUIRE(var["c"].isNull());
|
||||
REQUIRE(var[0].isNull());
|
||||
}
|
||||
|
||||
SECTION("supports std::string") {
|
||||
REQUIRE(std::string("A") == var[std::string("a")]);
|
||||
REQUIRE(std::string("B") == var[std::string("b")]);
|
||||
REQUIRE(var[std::string("c")].isNull());
|
||||
REQUIRE("A"_s == var["a"_s]);
|
||||
REQUIRE("B"_s == var["b"_s]);
|
||||
REQUIRE(var["c"_s].isNull());
|
||||
}
|
||||
|
||||
#if defined(HAS_VARIABLE_LENGTH_ARRAY) && \
|
||||
@@ -61,8 +73,14 @@ TEST_CASE("JsonVariantConst::operator[]") {
|
||||
char vla[i];
|
||||
strcpy(vla, "a");
|
||||
|
||||
REQUIRE(std::string("A") == var[vla]);
|
||||
REQUIRE("A"_s == var[vla]);
|
||||
}
|
||||
#endif
|
||||
|
||||
SECTION("supports JsonVariant") {
|
||||
object["c"] = "b";
|
||||
REQUIRE(var[var["c"]] == "B");
|
||||
REQUIRE(var[var["d"]].isNull());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user