Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yaml-cpp
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
yaml-cpp
Commits
973ac4b3
Commit
973ac4b3
authored
Sep 06, 2009
by
Jesse Beder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added spec tests through example 2.13
parent
e91a152e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
0 deletions
+49
-0
yaml-reader/spectests.cpp
+49
-0
No files found.
yaml-reader/spectests.cpp
View file @
973ac4b3
...
@@ -333,6 +333,53 @@ namespace Test {
...
@@ -333,6 +333,53 @@ namespace Test {
YAML_ASSERT
(
doc
[
Pair
(
"New York Yankees"
,
"Atlanta Braves"
)][
2
]
==
"2001-08-14"
);
YAML_ASSERT
(
doc
[
Pair
(
"New York Yankees"
,
"Atlanta Braves"
)][
2
]
==
"2001-08-14"
);
return
true
;
return
true
;
}
}
TEST
CompactNestedMapping
()
{
std
::
string
input
=
"---
\n
"
"# Products purchased
\n
"
"- item : Super Hoop
\n
"
" quantity: 1
\n
"
"- item : Basketball
\n
"
" quantity: 4
\n
"
"- item : Big Shoes
\n
"
" quantity: 1"
;
std
::
stringstream
stream
(
input
);
YAML
::
Parser
parser
(
stream
);
YAML
::
Node
doc
;
parser
.
GetNextDocument
(
doc
);
YAML_ASSERT
(
doc
.
size
()
==
3
);
YAML_ASSERT
(
doc
[
0
].
size
()
==
2
);
YAML_ASSERT
(
doc
[
0
][
"item"
]
==
"Super Hoop"
);
YAML_ASSERT
(
doc
[
0
][
"quantity"
]
==
1
);
YAML_ASSERT
(
doc
[
1
].
size
()
==
2
);
YAML_ASSERT
(
doc
[
1
][
"item"
]
==
"Basketball"
);
YAML_ASSERT
(
doc
[
1
][
"quantity"
]
==
4
);
YAML_ASSERT
(
doc
[
2
].
size
()
==
2
);
YAML_ASSERT
(
doc
[
2
][
"item"
]
==
"Big Shoes"
);
YAML_ASSERT
(
doc
[
2
][
"quantity"
]
==
1
);
return
true
;
}
TEST
InLiteralsNewlinesArePreserved
()
{
std
::
string
input
=
"# ASCII Art
\n
"
"--- |
\n
"
"
\\
//||
\\
/||
\n
"
" // || ||__"
;
std
::
stringstream
stream
(
input
);
YAML
::
Parser
parser
(
stream
);
YAML
::
Node
doc
;
parser
.
GetNextDocument
(
doc
);
YAML_ASSERT
(
doc
==
"
\\
//||
\\
/||
\n
"
"// || ||__"
);
return
true
;
}
}
}
bool
RunSpecTests
()
bool
RunSpecTests
()
...
@@ -349,6 +396,8 @@ namespace Test {
...
@@ -349,6 +396,8 @@ namespace Test {
RunSpecTest
(
&
Spec
::
SingleDocumentWithTwoComments
,
"2.9"
,
"Single Document with Two Comments"
,
passed
);
RunSpecTest
(
&
Spec
::
SingleDocumentWithTwoComments
,
"2.9"
,
"Single Document with Two Comments"
,
passed
);
RunSpecTest
(
&
Spec
::
SimpleAnchor
,
"2.10"
,
"Node for
\"
Sammy Sosa
\"
appears twice in this document"
,
passed
);
RunSpecTest
(
&
Spec
::
SimpleAnchor
,
"2.10"
,
"Node for
\"
Sammy Sosa
\"
appears twice in this document"
,
passed
);
RunSpecTest
(
&
Spec
::
MappingBetweenSequences
,
"2.11"
,
"Mapping between Sequences"
,
passed
);
RunSpecTest
(
&
Spec
::
MappingBetweenSequences
,
"2.11"
,
"Mapping between Sequences"
,
passed
);
RunSpecTest
(
&
Spec
::
CompactNestedMapping
,
"2.12"
,
"Compact Nested Mapping"
,
passed
);
RunSpecTest
(
&
Spec
::
InLiteralsNewlinesArePreserved
,
"2.13"
,
"In literals, newlines are preserved"
,
passed
);
return
passed
;
return
passed
;
}
}
...
...
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