Removed JsonArray::is<T>(i) and JsonArray::set(i,v)

Removed `JsonObject::is<T>(k)` and `JsonObject::set(k,v)`
Replaced `T JsonArray::get<T>(i)` with `JsonVariant JsonArray::get(i)`
Replaced `T JsonObject::get<T>(k)` with `JsonVariant JsonObject::get(k)`
This commit is contained in:
Benoit Blanchon
2018-10-18 14:51:02 +02:00
parent 4eee8e8bdf
commit 1a4515c0b9
20 changed files with 38 additions and 615 deletions

View File

@ -110,45 +110,6 @@ TEST_CASE("unsigned char[]") {
}
#endif
SECTION("get()") {
unsigned char key[] = "hello";
DynamicJsonDocument doc;
deserializeJson(doc, "{\"hello\":\"world\"}");
JsonObject obj = doc.as<JsonObject>();
REQUIRE(std::string("world") == obj.get<char*>(key));
}
SECTION("set() key") {
unsigned char key[] = "hello";
DynamicJsonDocument doc;
JsonObject obj = doc.to<JsonObject>();
obj.set(key, "world");
REQUIRE(std::string("world") == obj["hello"]);
}
SECTION("set() value") {
unsigned char value[] = "world";
DynamicJsonDocument doc;
JsonObject obj = doc.to<JsonObject>();
obj.set("hello", value);
REQUIRE(std::string("world") == obj["hello"]);
}
SECTION("set() key&value") {
unsigned char key[] = "world";
DynamicJsonDocument doc;
JsonObject obj = doc.to<JsonObject>();
obj.set(key, key);
REQUIRE(std::string("world") == obj["world"]);
}
SECTION("containsKey()") {
unsigned char key[] = "hello";
@ -169,16 +130,6 @@ TEST_CASE("unsigned char[]") {
REQUIRE(0 == obj.size());
}
SECTION("is()") {
unsigned char key[] = "hello";
DynamicJsonDocument doc;
deserializeJson(doc, "{\"hello\":42}");
JsonObject obj = doc.as<JsonObject>();
REQUIRE(true == obj.is<int>(key));
}
SECTION("createNestedArray()") {
unsigned char key[] = "hello";
@ -228,17 +179,6 @@ TEST_CASE("unsigned char[]") {
REQUIRE(std::string("world") == arr[0]);
}
SECTION("set()") {
unsigned char value[] = "world";
DynamicJsonDocument doc;
JsonArray arr = doc.to<JsonArray>();
arr.add("hello");
arr.set(0, value);
REQUIRE(std::string("world") == arr[0]);
}
}
SECTION("JsonArraySubscript") {