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
d88be8ef
Commit
d88be8ef
authored
Mar 27, 2017
by
Milo Yip
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #905 unable to set writeFlags for PrettyWriter
parent
430e8d4c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
1 deletion
+44
-1
prettywriter.h
include/rapidjson/prettywriter.h
+1
-1
prettywritertest.cpp
test/unittest/prettywritertest.cpp
+43
-0
No files found.
include/rapidjson/prettywriter.h
View file @
d88be8ef
...
...
@@ -47,7 +47,7 @@ enum PrettyFormatOptions {
template
<
typename
OutputStream
,
typename
SourceEncoding
=
UTF8
<>
,
typename
TargetEncoding
=
UTF8
<>
,
typename
StackAllocator
=
CrtAllocator
,
unsigned
writeFlags
=
kWriteDefaultFlags
>
class
PrettyWriter
:
public
Writer
<
OutputStream
,
SourceEncoding
,
TargetEncoding
,
StackAllocator
,
writeFlags
>
{
public
:
typedef
Writer
<
OutputStream
,
SourceEncoding
,
TargetEncoding
,
StackAllocator
>
Base
;
typedef
Writer
<
OutputStream
,
SourceEncoding
,
TargetEncoding
,
StackAllocator
,
writeFlags
>
Base
;
typedef
typename
Base
::
Ch
Ch
;
//! Constructor
...
...
test/unittest/prettywritertest.cpp
View file @
d88be8ef
...
...
@@ -258,6 +258,49 @@ TEST(PrettyWriter, InvalidEventSequence) {
}
}
TEST
(
PrettyWriter
,
NaN
)
{
double
nan
=
std
::
numeric_limits
<
double
>::
quiet_NaN
();
EXPECT_TRUE
(
internal
::
Double
(
nan
).
IsNan
());
StringBuffer
buffer
;
{
PrettyWriter
<
StringBuffer
>
writer
(
buffer
);
EXPECT_FALSE
(
writer
.
Double
(
nan
));
}
{
PrettyWriter
<
StringBuffer
,
UTF8
<>
,
UTF8
<>
,
CrtAllocator
,
kWriteNanAndInfFlag
>
writer
(
buffer
);
EXPECT_TRUE
(
writer
.
Double
(
nan
));
EXPECT_STREQ
(
"NaN"
,
buffer
.
GetString
());
}
GenericStringBuffer
<
UTF16
<>
>
buffer2
;
PrettyWriter
<
GenericStringBuffer
<
UTF16
<>
>
>
writer2
(
buffer2
);
EXPECT_FALSE
(
writer2
.
Double
(
nan
));
}
TEST
(
PrettyWriter
,
Inf
)
{
double
inf
=
std
::
numeric_limits
<
double
>::
infinity
();
EXPECT_TRUE
(
internal
::
Double
(
inf
).
IsInf
());
StringBuffer
buffer
;
{
PrettyWriter
<
StringBuffer
>
writer
(
buffer
);
EXPECT_FALSE
(
writer
.
Double
(
inf
));
}
{
PrettyWriter
<
StringBuffer
>
writer
(
buffer
);
EXPECT_FALSE
(
writer
.
Double
(
-
inf
));
}
{
PrettyWriter
<
StringBuffer
,
UTF8
<>
,
UTF8
<>
,
CrtAllocator
,
kWriteNanAndInfFlag
>
writer
(
buffer
);
EXPECT_TRUE
(
writer
.
Double
(
inf
));
}
{
PrettyWriter
<
StringBuffer
,
UTF8
<>
,
UTF8
<>
,
CrtAllocator
,
kWriteNanAndInfFlag
>
writer
(
buffer
);
EXPECT_TRUE
(
writer
.
Double
(
-
inf
));
}
EXPECT_STREQ
(
"Infinity-Infinity"
,
buffer
.
GetString
());
}
TEST
(
PrettyWriter
,
Issue_889
)
{
char
buf
[
100
]
=
"Hello"
;
...
...
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