mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2025-01-06 00:31:10 +01:00
add a testcase in ValueTest:CopyObject (#1028)
This commit is contained in:
parent
81ae1d55f7
commit
c97bd59ff2
@ -1515,6 +1515,24 @@ JSONTEST_FIXTURE(ValueTest, CopyObject) {
|
|||||||
JSONTEST_ASSERT(copy1 == "string value");
|
JSONTEST_ASSERT(copy1 == "string value");
|
||||||
copy2.copy(arrayVal);
|
copy2.copy(arrayVal);
|
||||||
JSONTEST_ASSERT(copy2.size() == 5);
|
JSONTEST_ASSERT(copy2.size() == 5);
|
||||||
|
{
|
||||||
|
Json::Value srcObject, objectCopy, otherObject;
|
||||||
|
srcObject["key0"] = 10;
|
||||||
|
objectCopy.copy(srcObject);
|
||||||
|
JSONTEST_ASSERT(srcObject["key0"] == 10);
|
||||||
|
JSONTEST_ASSERT(objectCopy["key0"] == 10);
|
||||||
|
JSONTEST_ASSERT(srcObject.getMemberNames().size() == 1);
|
||||||
|
JSONTEST_ASSERT(objectCopy.getMemberNames().size() == 1);
|
||||||
|
otherObject["key1"] = 15;
|
||||||
|
otherObject["key2"] = 16;
|
||||||
|
JSONTEST_ASSERT(otherObject.getMemberNames().size() == 2);
|
||||||
|
objectCopy.copy(otherObject);
|
||||||
|
JSONTEST_ASSERT(objectCopy["key1"] == 15);
|
||||||
|
JSONTEST_ASSERT(objectCopy["key2"] == 16);
|
||||||
|
JSONTEST_ASSERT(objectCopy.getMemberNames().size() == 2);
|
||||||
|
otherObject["key1"] = 20;
|
||||||
|
JSONTEST_ASSERT(objectCopy["key1"] == 15);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ValueTest::checkIsLess(const Json::Value& x, const Json::Value& y) {
|
void ValueTest::checkIsLess(const Json::Value& x, const Json::Value& y) {
|
||||||
|
Loading…
Reference in New Issue
Block a user