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
80dba56a
Commit
80dba56a
authored
Jun 15, 2018
by
abolz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests for issues with string-to-double conversions (#849, #1249, #1251, #1253, #1256, #1259)
parent
01c71740
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
1 deletion
+35
-1
readertest.cpp
test/unittest/readertest.cpp
+35
-1
No files found.
test/unittest/readertest.cpp
View file @
80dba56a
...
...
@@ -377,6 +377,21 @@ static void TestParseDouble() {
d
=
d
.
Value
()
*
0.5
;
}
}
// Issue 1249
TEST_DOUBLE
(
fullPrecision
,
"0e100"
,
0.0
);
// Issue 1251
TEST_DOUBLE
(
fullPrecision
,
"128.74836467836484838364836483643636483648e-336"
,
0.0
);
// Issue 1256
TEST_DOUBLE
(
fullPrecision
,
"6223372036854775296.1701512723685473547372536854755293372036854685477"
"529752233737201701512337200972013723685473123372036872036854236854737"
"247372368372367752975258547752975254729752547372368737201701512354737"
"83723677529752585477247372368372368547354737253685475529752"
,
6223372036854775808.0
);
#undef TEST_DOUBLE
}
...
...
@@ -443,7 +458,7 @@ TEST(Reader, ParseNumber_Error) {
for
(
int
i
=
1
;
i
<
310
;
i
++
)
n1e309
[
i
]
=
'0'
;
n1e309
[
310
]
=
'\0'
;
TEST_NUMBER_ERROR
(
kParseErrorNumberTooBig
,
n1e309
,
0
,
3
09
);
TEST_NUMBER_ERROR
(
kParseErrorNumberTooBig
,
n1e309
,
0
,
3
10
);
}
TEST_NUMBER_ERROR
(
kParseErrorNumberTooBig
,
"1e309"
,
0
,
5
);
...
...
@@ -455,6 +470,25 @@ TEST(Reader, ParseNumber_Error) {
TEST_NUMBER_ERROR
(
kParseErrorNumberMissExponent
,
"1e"
,
2
,
2
);
TEST_NUMBER_ERROR
(
kParseErrorNumberMissExponent
,
"1e_"
,
2
,
2
);
// Issue 849
TEST_NUMBER_ERROR
(
kParseErrorNumberTooBig
,
"1.8e308"
,
0
,
7
);
TEST_NUMBER_ERROR
(
kParseErrorNumberTooBig
,
"5e308"
,
0
,
5
);
TEST_NUMBER_ERROR
(
kParseErrorNumberTooBig
,
"1e309"
,
0
,
5
);
TEST_NUMBER_ERROR
(
kParseErrorNumberTooBig
,
"1.0e310"
,
0
,
7
);
TEST_NUMBER_ERROR
(
kParseErrorNumberTooBig
,
"1.00e310"
,
0
,
8
);
TEST_NUMBER_ERROR
(
kParseErrorNumberTooBig
,
"-1.8e308"
,
0
,
8
);
TEST_NUMBER_ERROR
(
kParseErrorNumberTooBig
,
"-1e309"
,
0
,
6
);
// Issue 1253
TEST_NUMBER_ERROR
(
kParseErrorNumberTooBig
,
"2e308"
,
0
,
5
);
// Issue 1259
TEST_NUMBER_ERROR
(
kParseErrorNumberTooBig
,
"88474320368547737236837236775298547354737253685475547552933720368546854775297525"
"29337203685468547770151233720097201372368547312337203687203685423685123372036872"
"03685473724737236837236775297525854775297525472975254737236873720170151235473783"
"7236737247372368772473723683723456789012E66"
,
0
,
283
);
#undef TEST_NUMBER_ERROR
}
...
...
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