"...text-generation-inference.git" did not exist on "10d9083b2d5c47e73d9acb4b6cf64b9fcad6c934"
Unverified Commit bdc5582b authored by Matthijs van der Burgh's avatar Matthijs van der Burgh Committed by GitHub
Browse files

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

parent 1b50109f
...@@ -323,6 +323,38 @@ TEST(NodeTest, IteratorOnConstUndefinedNode) { ...@@ -323,6 +323,38 @@ TEST(NodeTest, IteratorOnConstUndefinedNode) {
} }
EXPECT_EQ(0, count); 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) { TEST(NodeTest, SimpleSubkeys) {
Node node; Node node;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment