Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
R
rapidjson
Project
Project
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
rapidjson
Commits
3c6e2cf0
Commit
3c6e2cf0
authored
Mar 23, 2017
by
Alejandro Martinez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added unittests for invalid ascii control chars
parent
da4fd679
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
0 deletions
+12
-0
readertest.cpp
test/unittest/readertest.cpp
+2
-0
writertest.cpp
test/unittest/writertest.cpp
+10
-0
No files found.
test/unittest/readertest.cpp
View file @
3c6e2cf0
...
...
@@ -725,6 +725,8 @@ TEST(Reader, ParseString_Error) {
// Malform ASCII sequence
TEST_STRINGENCODING_ERROR
(
ASCII
<>
,
UTF8
<>
,
char
,
ARRAY
(
'['
,
'\"'
,
char
(
0x80u
),
'\"'
,
']'
,
'\0'
));
TEST_STRINGENCODING_ERROR
(
ASCII
<>
,
UTF8
<>
,
char
,
ARRAY
(
'['
,
'\"'
,
char
(
0x01u
),
'\"'
,
']'
,
'\0'
));
TEST_STRINGENCODING_ERROR
(
ASCII
<>
,
UTF8
<>
,
char
,
ARRAY
(
'['
,
'\"'
,
char
(
0x1Cu
),
'\"'
,
']'
,
'\0'
));
#undef ARRAY
#undef TEST_STRINGARRAY_ERROR
...
...
test/unittest/writertest.cpp
View file @
3c6e2cf0
...
...
@@ -401,6 +401,16 @@ TEST(Writer, InvalidEncoding) {
static
const
UTF32
<>::
Ch
s
[]
=
{
0x110000
,
0
};
// Out of U+0000 to U+10FFFF
EXPECT_FALSE
(
writer
.
String
(
s
));
}
// Fail in decoding invalid ASCII control bytes
{
GenericStringBuffer
<
UTF16
<>
>
buffer
;
Writer
<
GenericStringBuffer
<
UTF16
<>
>
,
UTF8
<>
,
UTF16
<>
>
writer
(
buffer
);
writer
.
StartArray
();
EXPECT_FALSE
(
writer
.
String
(
"
\x01
"
));
EXPECT_FALSE
(
writer
.
String
(
"
\x1C
"
));
writer
.
EndArray
();
}
}
TEST
(
Writer
,
ValidateEncoding
)
{
...
...
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