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
cfb7d462
Commit
cfb7d462
authored
May 08, 2012
by
beder
Browse files
Added test for BOOST_FOREACH on a map
parent
adc0e7e7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
0 deletions
+10
-0
test/new-api/nodetests.cpp
test/new-api/nodetests.cpp
+10
-0
No files found.
test/new-api/nodetests.cpp
View file @
cfb7d462
...
@@ -364,6 +364,15 @@ namespace Test
...
@@ -364,6 +364,15 @@ namespace Test
}
}
return
true
;
return
true
;
}
}
TEST
ForEachMap
()
{
YAML
::
Node
node
=
YAML
::
Load
(
"{a: A, b: B, c: C}"
);
BOOST_FOREACH
(
const
YAML
::
const_iterator
::
value_type
&
p
,
node
)
{
YAML_ASSERT
(
p
.
first
.
as
<
char
>
()
+
'A'
-
'a'
==
p
.
second
.
as
<
char
>
());
}
return
true
;
}
}
}
void
RunNodeTest
(
TEST
(
*
test
)(),
const
std
::
string
&
name
,
int
&
passed
,
int
&
total
)
{
void
RunNodeTest
(
TEST
(
*
test
)(),
const
std
::
string
&
name
,
int
&
passed
,
int
&
total
)
{
...
@@ -416,6 +425,7 @@ namespace Test
...
@@ -416,6 +425,7 @@ namespace Test
RunNodeTest
(
&
Node
::
IterateSequence
,
"iterate sequence"
,
passed
,
total
);
RunNodeTest
(
&
Node
::
IterateSequence
,
"iterate sequence"
,
passed
,
total
);
RunNodeTest
(
&
Node
::
IterateMap
,
"iterate map"
,
passed
,
total
);
RunNodeTest
(
&
Node
::
IterateMap
,
"iterate map"
,
passed
,
total
);
RunNodeTest
(
&
Node
::
ForEach
,
"for each"
,
passed
,
total
);
RunNodeTest
(
&
Node
::
ForEach
,
"for each"
,
passed
,
total
);
RunNodeTest
(
&
Node
::
ForEachMap
,
"for each map"
,
passed
,
total
);
std
::
cout
<<
"Node tests: "
<<
passed
<<
"/"
<<
total
<<
" passed
\n
"
;
std
::
cout
<<
"Node tests: "
<<
passed
<<
"/"
<<
total
<<
" passed
\n
"
;
return
passed
==
total
;
return
passed
==
total
;
...
...
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