Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
json
Project
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
Chen Yisong
json
Commits
8d1e65f2
Commit
8d1e65f2
authored
Oct 30, 2016
by
Niels
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
evaluated i-tests (#344)
parent
7b4e6cf7
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
46 additions
and
19 deletions
+46
-19
json.hpp
src/json.hpp
+5
-0
json.hpp.re2c
src/json.hpp.re2c
+5
-0
n_structure_3C.3E.json
...ta/nst_json_testsuite/test_parsing/n_structure_3C.3E.json
+0
-0
n_structure_3Cnull3E.json
...nst_json_testsuite/test_parsing/n_structure_3Cnull3E.json
+0
-0
unit-testsuites.cpp
test/src/unit-testsuites.cpp
+36
-19
No files found.
src/json.hpp
View file @
8d1e65f2
...
@@ -8934,6 +8934,11 @@ basic_json_parser_66:
...
@@ -8934,6 +8934,11 @@ basic_json_parser_66:
// skip the next 10 characters (xxxx\uyyyy)
// skip the next 10 characters (xxxx\uyyyy)
i
+=
10
;
i
+=
10
;
}
}
else
if
(
codepoint
>=
0xDC00
and
codepoint
<=
0xDFFF
)
{
// we found a lone low surrogate
throw
std
::
invalid_argument
(
"missing high surrogate"
);
}
else
else
{
{
// add unicode character(s)
// add unicode character(s)
...
...
src/json.hpp.re2c
View file @
8d1e65f2
...
@@ -8083,6 +8083,11 @@ class basic_json
...
@@ -8083,6 +8083,11 @@ class basic_json
// skip the next 10 characters (xxxx\uyyyy)
// skip the next 10 characters (xxxx\uyyyy)
i += 10;
i += 10;
}
}
else if (codepoint >= 0xDC00 and codepoint <= 0xDFFF)
{
// we found a lone low surrogate
throw std::invalid_argument("missing high surrogate");
}
else
else
{
{
// add unicode character(s)
// add unicode character(s)
...
...
test/data/nst_json_testsuite/test_parsing/n_structure_
<.>
.json
→
test/data/nst_json_testsuite/test_parsing/n_structure_
3C.3E
.json
View file @
8d1e65f2
File moved
test/data/nst_json_testsuite/test_parsing/n_structure_
<null>
.json
→
test/data/nst_json_testsuite/test_parsing/n_structure_
3Cnull3E
.json
View file @
8d1e65f2
File moved
test/src/unit-testsuites.cpp
View file @
8d1e65f2
...
@@ -703,8 +703,8 @@ TEST_CASE("nst's JSONTestSuite")
...
@@ -703,8 +703,8 @@ TEST_CASE("nst's JSONTestSuite")
"test/data/nst_json_testsuite/test_parsing/n_string_unicode_CapitalU.json"
,
"test/data/nst_json_testsuite/test_parsing/n_string_unicode_CapitalU.json"
,
"test/data/nst_json_testsuite/test_parsing/n_string_with_trailing_garbage.json"
,
"test/data/nst_json_testsuite/test_parsing/n_string_with_trailing_garbage.json"
,
//!"test/data/nst_json_testsuite/test_parsing/n_structure_100000_opening_arrays.json",
//!"test/data/nst_json_testsuite/test_parsing/n_structure_100000_opening_arrays.json",
"test/data/nst_json_testsuite/test_parsing/n_structure_
<.>
.json"
,
"test/data/nst_json_testsuite/test_parsing/n_structure_
3C.3E
.json"
,
"test/data/nst_json_testsuite/test_parsing/n_structure_
<null>
.json"
,
"test/data/nst_json_testsuite/test_parsing/n_structure_
3Cnull3E
.json"
,
"test/data/nst_json_testsuite/test_parsing/n_structure_U+2060_word_joined.json"
,
"test/data/nst_json_testsuite/test_parsing/n_structure_U+2060_word_joined.json"
,
"test/data/nst_json_testsuite/test_parsing/n_structure_UTF8_BOM_no_data.json"
,
"test/data/nst_json_testsuite/test_parsing/n_structure_UTF8_BOM_no_data.json"
,
"test/data/nst_json_testsuite/test_parsing/n_structure_array_trailing_garbage.json"
,
"test/data/nst_json_testsuite/test_parsing/n_structure_array_trailing_garbage.json"
,
...
@@ -761,31 +761,22 @@ TEST_CASE("nst's JSONTestSuite")
...
@@ -761,31 +761,22 @@ TEST_CASE("nst's JSONTestSuite")
}
}
}
}
SECTION
(
"i"
)
SECTION
(
"i
-> y
"
)
{
{
for
(
auto
filename
:
for
(
auto
filename
:
{
{
// we currently do not limit exponents
"test/data/nst_json_testsuite/test_parsing/i_number_neg_int_huge_exp.json"
,
"test/data/nst_json_testsuite/test_parsing/i_number_neg_int_huge_exp.json"
,
"test/data/nst_json_testsuite/test_parsing/i_number_pos_double_huge_exp.json"
,
"test/data/nst_json_testsuite/test_parsing/i_number_pos_double_huge_exp.json"
,
"test/data/nst_json_testsuite/test_parsing/i_object_key_lone_2nd_surrogate.json"
,
// we do not pose a limit on nesting
//"test/data/nst_json_testsuite/test_parsing/i_string_1st_surrogate_but_2nd_missing.json",
"test/data/nst_json_testsuite/test_parsing/i_structure_500_nested_arrays.json"
,
//"test/data/nst_json_testsuite/test_parsing/i_string_1st_valid_surrogate_2nd_invalid.json",
// we silently ignore BOMs
//"test/data/nst_json_testsuite/test_parsing/i_string_UTF-16_invalid_lonely_surrogate.json",
"test/data/nst_json_testsuite/test_parsing/i_structure_UTF-8_BOM_empty_object.json"
,
//"test/data/nst_json_testsuite/test_parsing/i_string_UTF-16_invalid_surrogate.json",
// we accept and forward non-characters
//"test/data/nst_json_testsuite/test_parsing/i_string_UTF-8_invalid_sequence.json",
//"test/data/nst_json_testsuite/test_parsing/i_string_incomplete_surrogate_and_escape_valid.json",
"test/data/nst_json_testsuite/test_parsing/i_string_incomplete_surrogate_pair.json"
,
//"test/data/nst_json_testsuite/test_parsing/i_string_incomplete_surrogates_escape_valid.json",
//"test/data/nst_json_testsuite/test_parsing/i_string_inverted_surrogates_U+1D11E.json",
"test/data/nst_json_testsuite/test_parsing/i_string_lone_second_surrogate.json"
,
//"test/data/nst_json_testsuite/test_parsing/i_string_not_in_unicode_range.json",
//"test/data/nst_json_testsuite/test_parsing/i_string_truncated-utf-8.json",
"test/data/nst_json_testsuite/test_parsing/i_string_unicode_U+10FFFE_nonchar.json"
,
"test/data/nst_json_testsuite/test_parsing/i_string_unicode_U+10FFFE_nonchar.json"
,
"test/data/nst_json_testsuite/test_parsing/i_string_unicode_U+1FFFE_nonchar.json"
,
"test/data/nst_json_testsuite/test_parsing/i_string_unicode_U+1FFFE_nonchar.json"
,
"test/data/nst_json_testsuite/test_parsing/i_string_unicode_U+FDD0_nonchar.json"
,
"test/data/nst_json_testsuite/test_parsing/i_string_unicode_U+FDD0_nonchar.json"
,
"test/data/nst_json_testsuite/test_parsing/i_string_unicode_U+FFFE_nonchar.json"
,
"test/data/nst_json_testsuite/test_parsing/i_string_unicode_U+FFFE_nonchar.json"
"test/data/nst_json_testsuite/test_parsing/i_structure_500_nested_arrays.json"
,
"test/data/nst_json_testsuite/test_parsing/i_structure_UTF-8_BOM_empty_object.json"
}
}
)
)
{
{
...
@@ -796,5 +787,31 @@ TEST_CASE("nst's JSONTestSuite")
...
@@ -796,5 +787,31 @@ TEST_CASE("nst's JSONTestSuite")
}
}
}
}
SECTION
(
"i -> n"
)
{
for
(
auto
filename
:
{
"test/data/nst_json_testsuite/test_parsing/i_object_key_lone_2nd_surrogate.json"
,
"test/data/nst_json_testsuite/test_parsing/i_string_1st_surrogate_but_2nd_missing.json"
,
"test/data/nst_json_testsuite/test_parsing/i_string_1st_valid_surrogate_2nd_invalid.json"
,
"test/data/nst_json_testsuite/test_parsing/i_string_UTF-16_invalid_lonely_surrogate.json"
,
"test/data/nst_json_testsuite/test_parsing/i_string_UTF-16_invalid_surrogate.json"
,
"test/data/nst_json_testsuite/test_parsing/i_string_UTF-8_invalid_sequence.json"
,
"test/data/nst_json_testsuite/test_parsing/i_string_incomplete_surrogate_and_escape_valid.json"
,
"test/data/nst_json_testsuite/test_parsing/i_string_incomplete_surrogate_pair.json"
,
"test/data/nst_json_testsuite/test_parsing/i_string_incomplete_surrogates_escape_valid.json"
,
"test/data/nst_json_testsuite/test_parsing/i_string_inverted_surrogates_U+1D11E.json"
,
"test/data/nst_json_testsuite/test_parsing/i_string_lone_second_surrogate.json"
,
"test/data/nst_json_testsuite/test_parsing/i_string_not_in_unicode_range.json"
,
"test/data/nst_json_testsuite/test_parsing/i_string_truncated-utf-8.json"
}
)
{
CAPTURE
(
filename
);
std
::
ifstream
f
(
filename
);
json
j
;
CHECK_THROWS_AS
(
j
<<
f
,
std
::
invalid_argument
);
}
}
}
}
}
}
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