Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
yaml-cpp
Commits
bdc5582b
Unverified
Commit
bdc5582b
authored
Mar 02, 2023
by
Matthijs van der Burgh
Committed by
GitHub
Mar 01, 2023
Browse files
Add tests for iterator and const_iterator on sequence (#1169)
parent
1b50109f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
0 deletions
+32
-0
test/node/node_test.cpp
test/node/node_test.cpp
+32
-0
No files found.
test/node/node_test.cpp
View file @
bdc5582b
...
@@ -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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment