Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
json
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
json
Commits
561accb0
Commit
561accb0
authored
9 years ago
by
Trevor Welsby
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed issue #199
parent
ff6f7231
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
338 additions
and
741 deletions
+338
-741
src/json.hpp
src/json.hpp
+332
-735
src/json.hpp.re2c
src/json.hpp.re2c
+1
-1
test/unit.cpp
test/unit.cpp
+5
-5
No files found.
src/json.hpp
View file @
561accb0
This diff is collapsed.
Click to expand it.
src/json.hpp.re2c
View file @
561accb0
...
@@ -7478,7 +7478,7 @@ class basic_json
...
@@ -7478,7 +7478,7 @@ class basic_json
// Negative, parse with strtoll and attempt cast to
// Negative, parse with strtoll and attempt cast to
// number_integer_t
// number_integer_t
if (attempt_cast(std::strtoll(reinterpret_cast<typename string_t::const_pointer>(m_start), &endptr,
if (attempt_cast(std::strtoll(reinterpret_cast<typename string_t::const_pointer>(m_start), &endptr,
10), result.m_value.number_
unsigned
))
10), result.m_value.number_
integer
))
{
{
result.m_type = value_t::number_integer;
result.m_type = value_t::number_integer;
}
}
...
...
This diff is collapsed.
Click to expand it.
test/unit.cpp
View file @
561accb0
...
@@ -12097,17 +12097,17 @@ TEST_CASE("regression tests")
...
@@ -12097,17 +12097,17 @@ TEST_CASE("regression tests")
// unsigned integer parsing - expected to overflow and be stored as a float
// unsigned integer parsing - expected to overflow and be stored as a float
j = custom_json::parse("4294967296"); // 2^32
j = custom_json::parse("4294967296"); // 2^32
CHECK(static_cast<int>(j.type()) == static_cast<int>(custom_json::value_t::number_float));
CHECK(static_cast<int>(j.type()) == static_cast<int>(custom_json::value_t::number_float));
CHECK(j.get<float>() == 4294967296.0);
CHECK(j.get<float>() == 4294967296.0
f
);
// integer object creation - expected to wrap and still be stored as an integer
// integer object creation - expected to wrap and still be stored as an integer
j = -2147483649LL; // -2^31-1
j = -2147483649LL; // -2^31-1
CHECK(static_cast<int>(j.type()) == static_cast<int>(custom_json::value_t::number_integer));
CHECK(static_cast<int>(j.type()) == static_cast<int>(custom_json::value_t::number_integer));
CHECK(j.get<int32_t>() == 2147483647
.0
); // Wrap
CHECK(j.get<int32_t>() == 2147483647); // Wrap
// integer parsing - expected to overflow and be stored as a float
// integer parsing - expected to overflow and be stored as a float
with rounding
j = custom_json::parse("-214748364
8
"); // -2^31
j = custom_json::parse("-214748364
9
"); // -2^31
CHECK(static_cast<int>(j.type()) == static_cast<int>(custom_json::value_t::number_float));
CHECK(static_cast<int>(j.type()) == static_cast<int>(custom_json::value_t::number_float));
CHECK(j.get<float>() == -21474836
48.0
);
CHECK(j.get<float>() == -21474836
50.0f
);
}
}
SECTION("issue #93 reverse_iterator operator inheritance problem")
SECTION("issue #93 reverse_iterator operator inheritance problem")
...
...
This diff is collapsed.
Click to expand it.
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