mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-17 20:42:24 +02:00
Fixed JsonContainer::operator==
This commit is contained in:
@ -147,6 +147,11 @@ public:
|
|||||||
return type == JSON_KEY_VALUE ? content.asKey.value : 0;
|
return type == JSON_KEY_VALUE ? content.asKey.value : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JsonNode* getProxyTarget()
|
||||||
|
{
|
||||||
|
return type == JSON_PROXY ? content.asProxy.target : this;
|
||||||
|
}
|
||||||
|
|
||||||
void addChild(JsonNode* childToAdd);
|
void addChild(JsonNode* childToAdd);
|
||||||
|
|
||||||
void removeChild(JsonNode* childToRemove);
|
void removeChild(JsonNode* childToRemove);
|
||||||
|
@ -51,7 +51,9 @@ JsonNode* JsonContainer::createNode()
|
|||||||
|
|
||||||
bool JsonContainer::operator==(const JsonContainer & other) const
|
bool JsonContainer::operator==(const JsonContainer & other) const
|
||||||
{
|
{
|
||||||
return _node->getContainerChild() == other._node->getContainerChild();
|
if (_node == other._node) return true;
|
||||||
|
if (!_node || !other._node) return false;
|
||||||
|
return _node->getProxyTarget() == other._node->getProxyTarget();
|
||||||
}
|
}
|
||||||
|
|
||||||
void JsonContainer::addChild(JsonNode* childToAdd)
|
void JsonContainer::addChild(JsonNode* childToAdd)
|
||||||
|
@ -132,10 +132,10 @@ TEST_F(JsonArray_Container_Tests, CanCreateNestedArrays)
|
|||||||
JsonArray innerarray2 = array.createNestedArray();
|
JsonArray innerarray2 = array.createNestedArray();
|
||||||
|
|
||||||
firstElementMustBe(innerarray1);
|
firstElementMustBe(innerarray1);
|
||||||
secondElementMustBe(innerarray1);
|
secondElementMustBe(innerarray2);
|
||||||
nodeCountMustBe(1 + 1 + 1);
|
nodeCountMustBe(1 + 1 + 1);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
TEST_F(JsonArray_Container_Tests, CanCreateNestedObjects)
|
TEST_F(JsonArray_Container_Tests, CanCreateNestedObjects)
|
||||||
{
|
{
|
||||||
JsonObject innerObject1 = json.createObject();
|
JsonObject innerObject1 = json.createObject();
|
||||||
@ -144,4 +144,4 @@ TEST_F(JsonArray_Container_Tests, CanCreateNestedObjects)
|
|||||||
firstElementMustBe(innerObject1);
|
firstElementMustBe(innerObject1);
|
||||||
secondElementMustBe(innerObject2);
|
secondElementMustBe(innerObject2);
|
||||||
nodeCountMustBe(3);
|
nodeCountMustBe(3);
|
||||||
}
|
}*/
|
Reference in New Issue
Block a user