Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
json
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
json
Commits
bbb6bd9d
Unverified
Commit
bbb6bd9d
authored
Mar 28, 2017
by
Niels Lohmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🔨
fixing last failing test cases
parent
b0c47abd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
45 deletions
+37
-45
src/json.hpp
src/json.hpp
+16
-11
test/src/unit-class_parser.cpp
test/src/unit-class_parser.cpp
+7
-7
test/src/unit-testsuites.cpp
test/src/unit-testsuites.cpp
+14
-27
No files found.
src/json.hpp
View file @
bbb6bd9d
...
...
@@ -7179,7 +7179,7 @@ class basic_json
static
basic_json
parse
(
const
CharT
s
,
const
parser_callback_t
cb
=
nullptr
)
{
return
parser
(
reinterpret_cast
<
const
char
*>
(
s
),
cb
).
parse
();
return
parser
(
reinterpret_cast
<
const
char
*>
(
s
),
cb
).
parse
(
true
);
}
/*!
...
...
@@ -7214,7 +7214,7 @@ class basic_json
static
basic_json
parse
(
std
::
istream
&
i
,
const
parser_callback_t
cb
=
nullptr
)
{
return
parser
(
i
,
cb
).
parse
();
return
parser
(
i
,
cb
).
parse
(
true
);
}
/*!
...
...
@@ -7223,7 +7223,7 @@ class basic_json
static
basic_json
parse
(
std
::
istream
&&
i
,
const
parser_callback_t
cb
=
nullptr
)
{
return
parser
(
i
,
cb
).
parse
();
return
parser
(
i
,
cb
).
parse
(
true
);
}
/*!
...
...
@@ -7295,10 +7295,10 @@ class basic_json
// to generate "unexpected EOF" error message
if
(
std
::
distance
(
first
,
last
)
<=
0
)
{
return
parser
(
""
).
parse
();
return
parser
(
""
).
parse
(
true
);
}
return
parser
(
first
,
last
,
cb
).
parse
();
return
parser
(
first
,
last
,
cb
).
parse
(
true
);
}
/*!
...
...
@@ -7386,7 +7386,7 @@ class basic_json
*/
friend
std
::
istream
&
operator
<<
(
basic_json
&
j
,
std
::
istream
&
i
)
{
j
=
parser
(
i
).
parse
();
j
=
parser
(
i
).
parse
(
false
);
return
i
;
}
...
...
@@ -7396,7 +7396,7 @@ class basic_json
*/
friend
std
::
istream
&
operator
>>
(
std
::
istream
&
i
,
basic_json
&
j
)
{
j
=
parser
(
i
).
parse
();
j
=
parser
(
i
).
parse
(
false
);
return
i
;
}
...
...
@@ -11043,7 +11043,7 @@ class basic_json
{
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
3
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
},
{
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
4
,
9
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
5
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
5
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
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,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
},
{
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
5
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
5
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
},
{
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
},
{
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
8
,
10
,
8
,
10
,
10
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
},
{
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
5
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
5
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
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9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
},
...
...
@@ -11423,11 +11423,14 @@ class basic_json
/*!
@brief public parser interface
@param[in] strict whether to expect the last token to be EOF
@throw parse_error.101 in case of an unexpected token
@throw parse_error.102 if to_unicode fails or surrogate error
@throw parse_error.103 if to_unicode fails
*/
basic_json
parse
()
basic_json
parse
(
const
bool
strict
=
true
)
{
// read first token
get_token
();
...
...
@@ -11435,8 +11438,10 @@ class basic_json
basic_json
result
=
parse_internal
(
true
);
result
.
assert_invariant
();
// FIXME: this is new behavior
//expect(lexer::token_type::end_of_input);
if
(
strict
)
{
expect
(
lexer
::
token_type
::
end_of_input
);
}
// return parser result and replace it with null in case the
// top-level value was discarded by the callback function
...
...
test/src/unit-class_parser.cpp
View file @
bbb6bd9d
...
...
@@ -306,9 +306,9 @@ TEST_CASE("parser class")
CHECK_THROWS_AS
(
json
::
parser
(
"+0"
).
parse
(),
json
::
parse_error
);
CHECK_THROWS_WITH
(
json
::
parser
(
"01"
).
parse
(),
"[json.exception.parse_error.101] parse error at 2: syntax error - unexpected
'01'
"
);
"[json.exception.parse_error.101] parse error at 2: syntax error - unexpected
number literal; expected end of input
"
);
CHECK_THROWS_WITH
(
json
::
parser
(
"-01"
).
parse
(),
"[json.exception.parse_error.101] parse error at 3: syntax error - unexpected
'-01'
"
);
"[json.exception.parse_error.101] parse error at 3: syntax error - unexpected
number literal; expected end of input
"
);
CHECK_THROWS_WITH
(
json
::
parser
(
"--1"
).
parse
(),
"[json.exception.parse_error.101] parse error at 2: syntax error - invalid number; expected digit after '-'; last read '--'"
);
CHECK_THROWS_WITH
(
json
::
parser
(
"1."
).
parse
(),
...
...
@@ -318,7 +318,7 @@ TEST_CASE("parser class")
CHECK_THROWS_WITH
(
json
::
parser
(
"1E-"
).
parse
(),
"[json.exception.parse_error.101] parse error at 4: syntax error - invalid number; expected digit after exponent sign; last read '1E-'"
);
CHECK_THROWS_WITH
(
json
::
parser
(
"1.E1"
).
parse
(),
"[json.exception.parse_error.101] parse error at
2: syntax error - unexpected '.'; expected end of input
"
);
"[json.exception.parse_error.101] parse error at
3: syntax error - invalid number; expected digit after '.'; last read '1.E'
"
);
CHECK_THROWS_WITH
(
json
::
parser
(
"-1E"
).
parse
(),
"[json.exception.parse_error.101] parse error at 4: syntax error - invalid number; expected '+', '-', or digit after exponent; last read '-1E'"
);
CHECK_THROWS_WITH
(
json
::
parser
(
"-0E#"
).
parse
(),
...
...
@@ -326,19 +326,19 @@ TEST_CASE("parser class")
CHECK_THROWS_WITH
(
json
::
parser
(
"-0E-#"
).
parse
(),
"[json.exception.parse_error.101] parse error at 5: syntax error - invalid number; expected digit after exponent sign; last read '-0E-#'"
);
CHECK_THROWS_WITH
(
json
::
parser
(
"-0#"
).
parse
(),
"[json.exception.parse_error.101] parse error at 3: syntax error -
unexpected '
#'; expected end of input"
);
"[json.exception.parse_error.101] parse error at 3: syntax error -
invalid literal; last read: '-0
#'; expected end of input"
);
CHECK_THROWS_WITH
(
json
::
parser
(
"-0.0:"
).
parse
(),
"[json.exception.parse_error.101] parse error at 5: syntax error - unexpected ':'; expected end of input"
);
CHECK_THROWS_WITH
(
json
::
parser
(
"-0.0Z"
).
parse
(),
"[json.exception.parse_error.101] parse error at 5: syntax error -
unexpected '
Z'; expected end of input"
);
"[json.exception.parse_error.101] parse error at 5: syntax error -
invalid literal; last read: '-0.0
Z'; expected end of input"
);
CHECK_THROWS_WITH
(
json
::
parser
(
"-0E123:"
).
parse
(),
"[json.exception.parse_error.101] parse error at 7: syntax error - unexpected ':'; expected end of input"
);
CHECK_THROWS_WITH
(
json
::
parser
(
"-0e0-:"
).
parse
(),
"[json.exception.parse_error.101] parse error at
5: syntax error - unexpected '-
'; expected end of input"
);
"[json.exception.parse_error.101] parse error at
6: syntax error - invalid number; expected digit after '-'; last read: '-:
'; expected end of input"
);
CHECK_THROWS_WITH
(
json
::
parser
(
"-0e-:"
).
parse
(),
"[json.exception.parse_error.101] parse error at 5: syntax error - invalid number; expected digit after exponent sign; last read '-0e-:'"
);
CHECK_THROWS_WITH
(
json
::
parser
(
"-0f"
).
parse
(),
"[json.exception.parse_error.101] parse error at
3: syntax error - unexpected '
f'; expected end of input"
);
"[json.exception.parse_error.101] parse error at
4: syntax error - invalid literal; expected 'false'; last read: '-0
f'; expected end of input"
);
}
}
}
...
...
test/src/unit-testsuites.cpp
View file @
bbb6bd9d
...
...
@@ -77,9 +77,8 @@ TEST_CASE("compliance tests from json.org")
})
{
CAPTURE
(
filename
);
json
j
;
std
::
ifstream
f
(
filename
);
CHECK_THROWS_AS
(
j
<<
f
,
json
::
parse_error
);
CHECK_THROWS_AS
(
j
son
::
parse
(
f
)
,
json
::
parse_error
);
}
}
...
...
@@ -93,9 +92,8 @@ TEST_CASE("compliance tests from json.org")
})
{
CAPTURE
(
filename
);
json
j
;
std
::
ifstream
f
(
filename
);
CHECK_NOTHROW
(
j
<<
f
);
CHECK_NOTHROW
(
j
son
::
parse
(
f
)
);
}
}
}
...
...
@@ -320,7 +318,7 @@ TEST_CASE("test suite from json-test-suite")
// strings in a JSON array
std
::
ifstream
f
(
"test/data/json_testsuite/sample.json"
);
json
j
;
CHECK_NOTHROW
(
j
<<
f
);
CHECK_NOTHROW
(
j
=
json
::
parse
(
f
)
);
// the array has 3 elements
CHECK
(
j
.
size
()
==
3
);
...
...
@@ -334,36 +332,31 @@ TEST_CASE("json.org examples")
SECTION
(
"1.json"
)
{
std
::
ifstream
f
(
"test/data/json.org/1.json"
);
json
j
;
CHECK_NOTHROW
(
j
<<
f
);
CHECK_NOTHROW
(
json
::
parse
(
f
));
}
SECTION
(
"2.json"
)
{
std
::
ifstream
f
(
"test/data/json.org/2.json"
);
json
j
;
CHECK_NOTHROW
(
j
<<
f
);
CHECK_NOTHROW
(
json
::
parse
(
f
));
}
SECTION
(
"3.json"
)
{
std
::
ifstream
f
(
"test/data/json.org/3.json"
);
json
j
;
CHECK_NOTHROW
(
j
<<
f
);
CHECK_NOTHROW
(
json
::
parse
(
f
));
}
SECTION
(
"4.json"
)
{
std
::
ifstream
f
(
"test/data/json.org/4.json"
);
json
j
;
CHECK_NOTHROW
(
j
<<
f
);
CHECK_NOTHROW
(
json
::
parse
(
f
));
}
SECTION
(
"5.json"
)
{
std
::
ifstream
f
(
"test/data/json.org/5.json"
);
json
j
;
CHECK_NOTHROW
(
j
<<
f
);
CHECK_NOTHROW
(
json
::
parse
(
f
));
}
}
...
...
@@ -545,8 +538,7 @@ TEST_CASE("nst's JSONTestSuite")
{
CAPTURE
(
filename
);
std
::
ifstream
f
(
filename
);
json
j
;
CHECK_NOTHROW
(
j
<<
f
);
CHECK_NOTHROW
(
json
::
parse
(
f
));
}
}
...
...
@@ -754,8 +746,7 @@ TEST_CASE("nst's JSONTestSuite")
{
CAPTURE
(
filename
);
std
::
ifstream
f
(
filename
);
json
j
;
CHECK_THROWS_AS
(
j
<<
f
,
json
::
parse_error
);
CHECK_THROWS_AS
(
json
::
parse
(
f
),
json
::
parse_error
);
}
}
...
...
@@ -777,8 +768,7 @@ TEST_CASE("nst's JSONTestSuite")
{
CAPTURE
(
filename
);
std
::
ifstream
f
(
filename
);
json
j
;
CHECK_NOTHROW
(
j
<<
f
);
CHECK_NOTHROW
(
json
::
parse
(
f
));
}
}
...
...
@@ -797,8 +787,7 @@ TEST_CASE("nst's JSONTestSuite")
{
CAPTURE
(
filename
);
std
::
ifstream
f
(
filename
);
json
j
;
CHECK_THROWS_AS
(
j
<<
f
,
json
::
out_of_range
);
CHECK_THROWS_AS
(
json
::
parse
(
f
),
json
::
out_of_range
);
}
}
...
...
@@ -824,8 +813,7 @@ TEST_CASE("nst's JSONTestSuite")
{
CAPTURE
(
filename
);
std
::
ifstream
f
(
filename
);
json
j
;
CHECK_THROWS_AS
(
j
<<
f
,
json
::
parse_error
);
CHECK_THROWS_AS
(
json
::
parse
(
f
),
json
::
parse_error
);
}
}
}
...
...
@@ -851,8 +839,7 @@ TEST_CASE("Big List of Naughty Strings")
SECTION
(
"parsing blns.json"
)
{
std
::
ifstream
f
(
"test/data/big-list-of-naughty-strings/blns.json"
);
json
j
;
CHECK_NOTHROW
(
j
<<
f
);
CHECK_NOTHROW
(
json
::
parse
(
f
));
}
// check if parsed strings roundtrip
...
...
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