mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-19 13:32:24 +02:00
@ -59,7 +59,7 @@ TEST_F(JsonObject_Container_Tests,
|
||||
|
||||
TEST_F(JsonObject_Container_Tests, CanStoreIntegers) {
|
||||
_object["hello"] = 123;
|
||||
_object["world"] = 456;
|
||||
_object.set("world", 456);
|
||||
|
||||
EXPECT_EQ(123, _object["hello"].as<int>());
|
||||
EXPECT_EQ(456, _object["world"].as<int>());
|
||||
@ -67,7 +67,7 @@ TEST_F(JsonObject_Container_Tests, CanStoreIntegers) {
|
||||
|
||||
TEST_F(JsonObject_Container_Tests, CanStoreDoubles) {
|
||||
_object["hello"] = 123.45;
|
||||
_object["world"] = 456.78;
|
||||
_object.set("world", 456.78);
|
||||
|
||||
EXPECT_EQ(123.45, _object["hello"].as<double>());
|
||||
EXPECT_EQ(456.78, _object["world"].as<double>());
|
||||
@ -75,7 +75,7 @@ TEST_F(JsonObject_Container_Tests, CanStoreDoubles) {
|
||||
|
||||
TEST_F(JsonObject_Container_Tests, CanStoreBooleans) {
|
||||
_object["hello"] = true;
|
||||
_object["world"] = false;
|
||||
_object.set("world", false);
|
||||
|
||||
EXPECT_TRUE(_object["hello"].as<bool>());
|
||||
EXPECT_FALSE(_object["world"].as<bool>());
|
||||
@ -83,32 +83,32 @@ TEST_F(JsonObject_Container_Tests, CanStoreBooleans) {
|
||||
|
||||
TEST_F(JsonObject_Container_Tests, CanStoreStrings) {
|
||||
_object["hello"] = "h3110";
|
||||
_object["world"] = "w0r1d";
|
||||
_object.set("world", "w0r1d");
|
||||
|
||||
EXPECT_STREQ("h3110", _object["hello"].as<const char*>());
|
||||
EXPECT_STREQ("w0r1d", _object["world"].as<const char*>());
|
||||
}
|
||||
|
||||
TEST_F(JsonObject_Container_Tests, CanStoreInnerArrays) {
|
||||
JsonArray& innerarray1 = _jsonBuffer.createArray();
|
||||
JsonArray& innerarray2 = _jsonBuffer.createArray();
|
||||
TEST_F(JsonObject_Container_Tests, CanStoreArrays) {
|
||||
JsonArray& array1 = _jsonBuffer.createArray();
|
||||
JsonArray& array2 = _jsonBuffer.createArray();
|
||||
|
||||
_object["hello"] = innerarray1;
|
||||
_object["world"] = innerarray2;
|
||||
_object["hello"] = array1;
|
||||
_object.set("world", array2);
|
||||
|
||||
EXPECT_EQ(&innerarray1, &_object["hello"].asArray());
|
||||
EXPECT_EQ(&innerarray2, &_object["world"].asArray());
|
||||
EXPECT_EQ(&array1, &_object["hello"].asArray());
|
||||
EXPECT_EQ(&array2, &_object["world"].asArray());
|
||||
}
|
||||
|
||||
TEST_F(JsonObject_Container_Tests, CanStoreInnerObjects) {
|
||||
JsonObject& innerObject1 = _jsonBuffer.createObject();
|
||||
JsonObject& innerObject2 = _jsonBuffer.createObject();
|
||||
TEST_F(JsonObject_Container_Tests, CanStoreObjects) {
|
||||
JsonObject& object1 = _jsonBuffer.createObject();
|
||||
JsonObject& object2 = _jsonBuffer.createObject();
|
||||
|
||||
_object["hello"] = innerObject1;
|
||||
_object["world"] = innerObject2;
|
||||
_object["hello"] = object1;
|
||||
_object.set("world", object2);
|
||||
|
||||
EXPECT_EQ(&innerObject1, &_object["hello"].asObject());
|
||||
EXPECT_EQ(&innerObject2, &_object["world"].asObject());
|
||||
EXPECT_EQ(&object1, &_object["hello"].asObject());
|
||||
EXPECT_EQ(&object2, &_object["world"].asObject());
|
||||
}
|
||||
|
||||
TEST_F(JsonObject_Container_Tests, ContainsKeyReturnsFalseForNonExistingKey) {
|
||||
|
Reference in New Issue
Block a user