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
16fd111a
Commit
16fd111a
authored
May 20, 2012
by
Jesse Beder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed formatting for spec tests
parent
030f4858
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
12 deletions
+18
-12
test/core/spectests.cpp
+18
-12
No files found.
test/core/spectests.cpp
View file @
16fd111a
...
...
@@ -7,6 +7,12 @@
#define YAML_ASSERT(cond) do { if(!(cond)) return " Assert failed: " #cond; } while(false)
namespace
Test
{
std
::
string
Quote
(
const
std
::
string
&
text
)
{
YAML
::
Emitter
out
;
out
<<
YAML
::
DoubleQuoted
<<
text
;
return
out
.
c_str
();
}
struct
Event
{
enum
Type
{
DocStart
,
DocEnd
,
Null
,
Alias
,
Scalar
,
SeqStart
,
SeqEnd
,
MapStart
,
MapEnd
};
...
...
@@ -31,13 +37,13 @@ namespace Test {
case
Alias
:
return
out
<<
"Alias("
<<
anchor
<<
")"
;
case
Scalar
:
return
out
<<
"Scalar("
<<
tag
<<
", "
<<
anchor
<<
", "
<<
scalar
<<
")"
;
return
out
<<
"Scalar("
<<
Quote
(
tag
)
<<
", "
<<
anchor
<<
", "
<<
Quote
(
scalar
)
<<
")"
;
case
SeqStart
:
return
out
<<
"SeqStart("
<<
tag
<<
", "
<<
anchor
<<
")"
;
return
out
<<
"SeqStart("
<<
Quote
(
tag
)
<<
", "
<<
anchor
<<
")"
;
case
SeqEnd
:
return
out
<<
"SeqEnd"
;
case
MapStart
:
return
out
<<
"MapStart("
<<
tag
<<
", "
<<
anchor
<<
")"
;
return
out
<<
"MapStart("
<<
Quote
(
tag
)
<<
", "
<<
anchor
<<
")"
;
case
MapEnd
:
return
out
<<
"MapEnd"
;
}
...
...
@@ -110,30 +116,30 @@ namespace Test {
if
(
i
>=
m_expectedEvents
.
size
())
{
std
::
stringstream
out
;
for
(
std
::
size_t
j
=
0
;
j
<
i
;
j
++
)
{
out
<<
m_expectedEvents
[
j
]
<<
"
\n
"
;
out
<<
" "
<<
m_expectedEvents
[
j
]
<<
"
\n
"
;
}
out
<<
"EXPECTED: (no event expected)
\n
"
;
out
<<
"ACTUAL : "
<<
m_actualEvents
[
i
]
<<
"
\n
"
;
out
<<
"
EXPECTED: (no event expected)
\n
"
;
out
<<
"
ACTUAL : "
<<
m_actualEvents
[
i
]
<<
"
\n
"
;
return
out
.
str
().
c_str
();
}
if
(
i
>=
m_actualEvents
.
size
())
{
std
::
stringstream
out
;
for
(
std
::
size_t
j
=
0
;
j
<
i
;
j
++
)
{
out
<<
m_expectedEvents
[
j
]
<<
"
\n
"
;
out
<<
" "
<<
m_expectedEvents
[
j
]
<<
"
\n
"
;
}
out
<<
"EXPECTED: "
<<
m_expectedEvents
[
i
]
<<
"
\n
"
;
out
<<
"ACTUAL : (no event recorded)
\n
"
;
out
<<
"
EXPECTED: "
<<
m_expectedEvents
[
i
]
<<
"
\n
"
;
out
<<
"
ACTUAL : (no event recorded)
\n
"
;
return
out
.
str
().
c_str
();
}
if
(
m_expectedEvents
[
i
]
!=
m_actualEvents
[
i
])
{
std
::
stringstream
out
;
for
(
std
::
size_t
j
=
0
;
j
<
i
;
j
++
)
{
out
<<
m_expectedEvents
[
j
]
<<
"
\n
"
;
out
<<
" "
<<
m_expectedEvents
[
j
]
<<
"
\n
"
;
}
out
<<
"EXPECTED: "
<<
m_expectedEvents
[
i
]
<<
"
\n
"
;
out
<<
"ACTUAL : "
<<
m_actualEvents
[
i
]
<<
"
\n
"
;
out
<<
"
EXPECTED: "
<<
m_expectedEvents
[
i
]
<<
"
\n
"
;
out
<<
"
ACTUAL : "
<<
m_actualEvents
[
i
]
<<
"
\n
"
;
return
out
.
str
().
c_str
();
}
}
...
...
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