mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2024-12-28 20:15:24 +08:00
test removeIndex/Member()
This commit is contained in:
parent
e87e41cdb0
commit
e893625e88
@ -198,6 +198,14 @@ JSONTEST_FIXTURE(ValueTest, objects) {
|
||||
|
||||
object1_["some other id"] = "foo";
|
||||
JSONTEST_ASSERT_EQUAL(Json::Value("foo"), object1_["some other id"]);
|
||||
JSONTEST_ASSERT_EQUAL(Json::Value("foo"), object1_["some other id"]);
|
||||
|
||||
// Remove.
|
||||
Json::Value got;
|
||||
got = object1_.removeMember("some other id");
|
||||
JSONTEST_ASSERT_EQUAL(Json::Value("foo"), got);
|
||||
got = object1_.removeMember("some other id");
|
||||
JSONTEST_ASSERT_EQUAL(Json::nullValue, got);
|
||||
}
|
||||
|
||||
JSONTEST_FIXTURE(ValueTest, arrays) {
|
||||
@ -240,6 +248,10 @@ JSONTEST_FIXTURE(ValueTest, arrays) {
|
||||
array1_[2] = Json::Value(17);
|
||||
JSONTEST_ASSERT_EQUAL(Json::Value(), array1_[1]);
|
||||
JSONTEST_ASSERT_EQUAL(Json::Value(17), array1_[2]);
|
||||
Json::Value got;
|
||||
JSONTEST_ASSERT_EQUAL(true, array1_.removeIndex(2, &got));
|
||||
JSONTEST_ASSERT_EQUAL(Json::Value(17), got);
|
||||
JSONTEST_ASSERT_EQUAL(false, array1_.removeIndex(2, &got)); // gone now
|
||||
}
|
||||
|
||||
JSONTEST_FIXTURE(ValueTest, null) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user