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
3da4afd2
Commit
3da4afd2
authored
Apr 16, 2016
by
Milo Yip
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Another trial on writer coverage
parent
8fcc65bf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
19 deletions
+27
-19
simdtest.cpp
test/unittest/simdtest.cpp
+22
-18
writertest.cpp
test/unittest/writertest.cpp
+5
-1
No files found.
test/unittest/simdtest.cpp
View file @
3da4afd2
...
...
@@ -105,24 +105,28 @@ struct ScanCopyUnescapedStringHandler : BaseReaderHandler<UTF8<>, ScanCopyUnesca
template
<
unsigned
parseFlags
,
typename
StreamType
>
void
TestScanCopyUnescapedString
()
{
for
(
size_t
step
=
0
;
step
<
1024
;
step
++
)
{
char
json
[
1024
+
5
];
char
*
p
=
json
;
*
p
++=
'\"'
;
for
(
size_t
i
=
0
;
i
<
step
;
i
++
)
*
p
++=
"ABCD"
[
i
%
4
];
*
p
++
=
'\\'
;
*
p
++
=
'\\'
;
*
p
++
=
'\"'
;
*
p
++
=
'\0'
;
StreamType
s
(
json
);
Reader
reader
;
ScanCopyUnescapedStringHandler
h
;
reader
.
Parse
<
parseFlags
>
(
s
,
h
);
EXPECT_TRUE
(
memcmp
(
h
.
buffer
,
json
+
1
,
step
)
==
0
);
EXPECT_EQ
(
'\\'
,
h
.
buffer
[
step
]);
// escaped
EXPECT_EQ
(
'\0'
,
h
.
buffer
[
step
+
1
]);
char
buffer
[
1024
+
5
+
32
];
for
(
size_t
offset
=
0
;
offset
<
32
;
offset
++
)
{
for
(
size_t
step
=
0
;
step
<
1024
;
step
++
)
{
char
*
json
=
buffer
+
offset
;
char
*
p
=
json
;
*
p
++
=
'\"'
;
for
(
size_t
i
=
0
;
i
<
step
;
i
++
)
*
p
++
=
"ABCD"
[
i
%
4
];
*
p
++
=
'\\'
;
*
p
++
=
'\\'
;
*
p
++
=
'\"'
;
*
p
++
=
'\0'
;
StreamType
s
(
json
);
Reader
reader
;
ScanCopyUnescapedStringHandler
h
;
reader
.
Parse
<
parseFlags
>
(
s
,
h
);
EXPECT_TRUE
(
memcmp
(
h
.
buffer
,
json
+
1
,
step
)
==
0
);
EXPECT_EQ
(
'\\'
,
h
.
buffer
[
step
]);
// escaped
EXPECT_EQ
(
'\0'
,
h
.
buffer
[
step
+
1
]);
}
}
}
...
...
test/unittest/writertest.cpp
View file @
3da4afd2
...
...
@@ -448,6 +448,10 @@ TEST(Writer, NaN) {
StringBuffer
buffer
;
Writer
<
StringBuffer
>
writer
(
buffer
);
EXPECT_FALSE
(
writer
.
Double
(
nan
));
GenericStringBuffer
<
UTF16
<>
>
buffer2
;
Writer
<
GenericStringBuffer
<
UTF16
<>
>
>
writer2
(
buffer2
);
EXPECT_FALSE
(
writer2
.
Double
(
nan
));
}
TEST
(
Writer
,
Inf
)
{
...
...
@@ -456,7 +460,7 @@ TEST(Writer, Inf) {
StringBuffer
buffer
;
{
Writer
<
StringBuffer
>
writer
(
buffer
);
EXPECT_FALSE
(
writer
.
Double
(
inf
));
EXPECT_FALSE
(
writer
.
Double
(
inf
));
}
{
Writer
<
StringBuffer
>
writer
(
buffer
);
...
...
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