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
a6e1d4cf
Commit
a6e1d4cf
authored
Sep 12, 2011
by
Jesse Beder
Browse files
Added two alias tests
parent
5397a937
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
0 deletions
+27
-0
test/new-api/nodetests.cpp
test/new-api/nodetests.cpp
+27
-0
No files found.
test/new-api/nodetests.cpp
View file @
a6e1d4cf
...
@@ -163,6 +163,31 @@ namespace Test
...
@@ -163,6 +163,31 @@ namespace Test
YAML_ASSERT
((
node
[
"squares"
].
as
<
std
::
map
<
int
,
int
>
>
()
==
squares
));
YAML_ASSERT
((
node
[
"squares"
].
as
<
std
::
map
<
int
,
int
>
>
()
==
squares
));
return
true
;
return
true
;
}
}
TEST
SimpleAlias
()
{
YAML
::
Node
node
;
node
[
"foo"
]
=
"value"
;
node
[
"bar"
]
=
node
[
"foo"
];
YAML_ASSERT
(
node
[
"foo"
].
as
<
std
::
string
>
()
==
"value"
);
YAML_ASSERT
(
node
[
"bar"
].
as
<
std
::
string
>
()
==
"value"
);
YAML_ASSERT
(
node
[
"foo"
]
==
node
[
"bar"
]);
YAML_ASSERT
(
node
.
size
()
==
2
);
return
true
;
}
TEST
AliasAsKey
()
{
YAML
::
Node
node
;
node
[
"foo"
]
=
"value"
;
YAML
::
Node
value
=
node
[
"foo"
];
node
[
value
]
=
"foo"
;
YAML_ASSERT
(
node
[
"foo"
].
as
<
std
::
string
>
()
==
"value"
);
YAML_ASSERT
(
node
[
value
].
as
<
std
::
string
>
()
==
"foo"
);
YAML_ASSERT
(
node
[
"value"
].
as
<
std
::
string
>
()
==
"foo"
);
YAML_ASSERT
(
node
.
size
()
==
2
);
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
)
{
...
@@ -198,6 +223,8 @@ namespace Test
...
@@ -198,6 +223,8 @@ namespace Test
RunNodeTest
(
&
Node
::
StdVector
,
"std::vector"
,
passed
,
total
);
RunNodeTest
(
&
Node
::
StdVector
,
"std::vector"
,
passed
,
total
);
RunNodeTest
(
&
Node
::
StdList
,
"std::list"
,
passed
,
total
);
RunNodeTest
(
&
Node
::
StdList
,
"std::list"
,
passed
,
total
);
RunNodeTest
(
&
Node
::
StdMap
,
"std::map"
,
passed
,
total
);
RunNodeTest
(
&
Node
::
StdMap
,
"std::map"
,
passed
,
total
);
RunNodeTest
(
&
Node
::
SimpleAlias
,
"simple alias"
,
passed
,
total
);
RunNodeTest
(
&
Node
::
AliasAsKey
,
"alias as key"
,
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