Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
json
Project
Overview
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
json
Commits
3716a2fb
Commit
3716a2fb
authored
Nov 02, 2016
by
Niels
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into feature/jsontestsuite
parents
59c83438
737d4372
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
0 deletions
+20
-0
json.hpp
src/json.hpp
+7
-0
json.hpp.re2c
src/json.hpp.re2c
+7
-0
unit-regression.cpp
test/src/unit-regression.cpp
+6
-0
No files found.
src/json.hpp
View file @
3716a2fb
...
@@ -9121,6 +9121,13 @@ basic_json_parser_66:
...
@@ -9121,6 +9121,13 @@ basic_json_parser_66:
{
{
// parse with strtod
// parse with strtod
result
.
m_value
.
number_float
=
str_to_float_t
(
static_cast
<
number_float_t
*>
(
nullptr
),
NULL
);
result
.
m_value
.
number_float
=
str_to_float_t
(
static_cast
<
number_float_t
*>
(
nullptr
),
NULL
);
// replace infinity and NAN by null
if
(
not
std
::
isfinite
(
result
.
m_value
.
number_float
))
{
type
=
value_t
::
null
;
result
.
m_value
=
basic_json
::
json_value
();
}
}
}
// save the type
// save the type
...
...
src/json.hpp.re2c
View file @
3716a2fb
...
@@ -8270,6 +8270,13 @@ class basic_json
...
@@ -8270,6 +8270,13 @@ class basic_json
{
{
// parse with strtod
// parse with strtod
result.m_value.number_float = str_to_float_t(static_cast<number_float_t*>(nullptr), NULL);
result.m_value.number_float = str_to_float_t(static_cast<number_float_t*>(nullptr), NULL);
// replace infinity and NAN by null
if (not std::isfinite(result.m_value.number_float))
{
type = value_t::null;
result.m_value = basic_json::json_value();
}
}
}
// save the type
// save the type
...
...
test/src/unit-regression.cpp
View file @
3716a2fb
...
@@ -489,4 +489,10 @@ TEST_CASE("regression tests")
...
@@ -489,4 +489,10 @@ TEST_CASE("regression tests")
j
[
"/this/that/2"
_json_pointer
]
=
27
;
j
[
"/this/that/2"
_json_pointer
]
=
27
;
CHECK
(
j
==
json
({{
"this"
,
{{
"that"
,
{
nullptr
,
nullptr
,
27
}}}}}));
CHECK
(
j
==
json
({{
"this"
,
{{
"that"
,
{
nullptr
,
nullptr
,
27
}}}}}));
}
}
SECTION
(
"issue #329 - serialized value not always can be parsed"
)
{
json
j
=
json
::
parse
(
"22e2222"
);
CHECK
(
j
==
json
());
}
}
}
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