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
2d920e7e
Commit
2d920e7e
authored
Feb 25, 2015
by
Milo Yip
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add user buffer unit test
parent
51f439ed
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
0 deletions
+13
-0
documenttest.cpp
test/unittest/documenttest.cpp
+13
-0
No files found.
test/unittest/documenttest.cpp
View file @
2d920e7e
...
...
@@ -212,6 +212,19 @@ TEST(Document, AcceptWriter) {
EXPECT_EQ
(
"{
\"
hello
\"
:
\"
world
\"
,
\"
t
\"
:true,
\"
f
\"
:false,
\"
n
\"
:null,
\"
i
\"
:123,
\"
pi
\"
:3.1416,
\"
a
\"
:[1,2,3,4]}"
,
os
.
str
());
}
TEST
(
Document
,
UserBuffer
)
{
typedef
GenericDocument
<
UTF8
<>
,
MemoryPoolAllocator
<>
,
MemoryPoolAllocator
<>>
DocumentType
;
char
valueBuffer
[
4096
];
char
parseBuffer
[
1024
];
MemoryPoolAllocator
<>
valueAllocator
(
valueBuffer
,
sizeof
(
valueBuffer
));
MemoryPoolAllocator
<>
parseAllocator
(
parseBuffer
,
sizeof
(
parseBuffer
));
DocumentType
doc
(
&
valueAllocator
,
sizeof
(
parseBuffer
),
&
parseAllocator
);
doc
.
Parse
(
" {
\"
hello
\"
:
\"
world
\"
,
\"
t
\"
: true ,
\"
f
\"
: false,
\"
n
\"
: null,
\"
i
\"
:123,
\"
pi
\"
: 3.1416,
\"
a
\"
:[1, 2, 3, 4] } "
);
EXPECT_FALSE
(
doc
.
HasParseError
());
EXPECT_LE
(
valueAllocator
.
Size
(),
sizeof
(
valueBuffer
));
EXPECT_LE
(
parseAllocator
.
Size
(),
sizeof
(
parseBuffer
));
}
// Issue 226: Value of string type should not point to NULL
TEST
(
Document
,
AssertAcceptInvalidNameType
)
{
Document
doc
;
...
...
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