Add tests for iterator and const_iterator on sequence (#1169)

This commit is contained in:
Matthijs van der Burgh 2023-03-02 02:27:51 +01:00 committed by GitHub
parent 1b50109f7b
commit bdc5582b35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -324,6 +324,38 @@ TEST(NodeTest, IteratorOnConstUndefinedNode) {
EXPECT_EQ(0, count);
}
TEST(NodeTest, InteratorOnSequence) {
Node node;
node[0] = "a";
node[1] = "b";
node[2] = "c";
EXPECT_TRUE(node.IsSequence());
std::size_t count = 0;
for (iterator it = node.begin(); it != node.end(); ++it)
{
EXPECT_FALSE(it->IsNull());
count++;
}
EXPECT_EQ(3, count);
}
TEST(NodeTest, ConstInteratorOnSequence) {
Node node;
node[0] = "a";
node[1] = "b";
node[2] = "c";
EXPECT_TRUE(node.IsSequence());
std::size_t count = 0;
for (const_iterator it = node.begin(); it != node.end(); ++it)
{
EXPECT_FALSE(it->IsNull());
count++;
}
EXPECT_EQ(3, count);
}
TEST(NodeTest, SimpleSubkeys) {
Node node;
node["device"]["udid"] = "12345";