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
3a5cf9bd
Unverified
Commit
3a5cf9bd
authored
Apr 01, 2017
by
Niels Lohmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🔨
improved code coverage
parent
c32d2e5b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
6 deletions
+13
-6
json.hpp
src/json.hpp
+4
-6
unit-class_lexer.cpp
test/src/unit-class_lexer.cpp
+9
-0
No files found.
src/json.hpp
View file @
3a5cf9bd
...
...
@@ -10965,6 +10965,9 @@ class basic_json
codepoint
=
codepoint1
;
}
// result of the above calculation yields a proper codepoint
assert
(
0x00
<=
codepoint
and
codepoint
<=
0x10FFFF
);
// translate code point to bytes
if
(
codepoint
<
0x80
)
{
...
...
@@ -10984,7 +10987,7 @@ class basic_json
add
(
0x80
|
((
codepoint
>>
6
)
&
0x3F
));
add
(
0x80
|
(
codepoint
&
0x3F
));
}
else
if
(
codepoint
<=
0x10ffff
)
else
{
// 4-byte characters: 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
add
(
0xF0
|
(
codepoint
>>
18
));
...
...
@@ -10992,11 +10995,6 @@ class basic_json
add
(
0x80
|
((
codepoint
>>
6
)
&
0x3F
));
add
(
0x80
|
(
codepoint
&
0x3F
));
}
else
{
error_message
=
"invalid string: code points above U+10FFFF are invalid"
;
return
token_type
::
parse_error
;
}
break
;
}
...
...
test/src/unit-class_lexer.cpp
View file @
3a5cf9bd
...
...
@@ -158,6 +158,15 @@ TEST_CASE("lexer class")
}
}
SECTION
(
"very large string"
)
{
// strings larger than 1024 bytes yield a resize of the lexer's yytext buffer
std
::
string
s
(
"
\"
"
);
s
+=
std
::
string
(
2048
,
'x'
);
s
+=
"
\"
"
;
CHECK
((
json
::
lexer
(
s
.
c_str
(),
2050
).
scan
()
==
json
::
lexer
::
token_type
::
value_string
));
}
/* NOTE: to_unicode function has been removed
SECTION("to_unicode")
{
...
...
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