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
f03c6ce4
Commit
f03c6ce4
authored
Apr 12, 2015
by
Niels
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added missing test cases
parent
dda8a5c4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
9 deletions
+17
-9
json.hpp
src/json.hpp
+1
-1
json.hpp.re2c
src/json.hpp.re2c
+1
-1
unit.cpp
test/unit.cpp
+15
-7
No files found.
src/json.hpp
View file @
f03c6ce4
...
...
@@ -3541,7 +3541,7 @@ class basic_json
}
/// return the value of an iterator
inline
reference
value
()
const
inline
const_
reference
value
()
const
{
return
this
->
base
().
operator
*
();
}
...
...
src/json.hpp.re2c
View file @
f03c6ce4
...
...
@@ -3541,7 +3541,7 @@ class basic_json
}
/// return the value of an iterator
inline reference value() const
inline
const_
reference value() const
{
return this->base().operator * ();
}
...
...
test/unit.cpp
View file @
f03c6ce4
...
...
@@ -3846,7 +3846,7 @@ TEST_CASE("iterators")
CHECK
(
cit
.
value
()
==
json
(
true
));
auto
rit
=
j
.
rend
();
auto
crit
=
j
.
rend
();
auto
crit
=
j
.
c
rend
();
CHECK_THROWS_AS
(
rit
.
key
(),
std
::
domain_error
);
CHECK
(
rit
.
value
()
==
json
(
true
));
CHECK_THROWS_AS
(
crit
.
key
(),
std
::
domain_error
);
...
...
@@ -4044,7 +4044,7 @@ TEST_CASE("iterators")
CHECK
(
cit
.
value
()
==
json
(
"hello world"
));
auto
rit
=
j
.
rend
();
auto
crit
=
j
.
rend
();
auto
crit
=
j
.
c
rend
();
CHECK_THROWS_AS
(
rit
.
key
(),
std
::
domain_error
);
CHECK
(
rit
.
value
()
==
json
(
"hello world"
));
CHECK_THROWS_AS
(
crit
.
key
(),
std
::
domain_error
);
...
...
@@ -4235,7 +4235,7 @@ TEST_CASE("iterators")
CHECK
(
cit
.
value
()
==
json
(
1
));
auto
rit
=
j
.
rend
();
auto
crit
=
j
.
rend
();
auto
crit
=
j
.
c
rend
();
CHECK_THROWS_AS
(
rit
.
key
(),
std
::
domain_error
);
CHECK
(
rit
.
value
()
==
json
(
1
));
CHECK_THROWS_AS
(
crit
.
key
(),
std
::
domain_error
);
...
...
@@ -4426,7 +4426,7 @@ TEST_CASE("iterators")
CHECK
(
cit
.
value
()
==
json
(
1
));
auto
rit
=
j
.
rend
();
auto
crit
=
j
.
rend
();
auto
crit
=
j
.
c
rend
();
CHECK
(
rit
.
key
()
==
"A"
);
CHECK
(
rit
.
value
()
==
json
(
1
));
CHECK
(
crit
.
key
()
==
"A"
);
...
...
@@ -4624,7 +4624,7 @@ TEST_CASE("iterators")
CHECK
(
cit
.
value
()
==
json
(
23
));
auto
rit
=
j
.
rend
();
auto
crit
=
j
.
rend
();
auto
crit
=
j
.
c
rend
();
CHECK_THROWS_AS
(
rit
.
key
(),
std
::
domain_error
);
CHECK
(
rit
.
value
()
==
json
(
23
));
CHECK_THROWS_AS
(
crit
.
key
(),
std
::
domain_error
);
...
...
@@ -4822,7 +4822,7 @@ TEST_CASE("iterators")
CHECK
(
cit
.
value
()
==
json
(
23.42
));
auto
rit
=
j
.
rend
();
auto
crit
=
j
.
rend
();
auto
crit
=
j
.
c
rend
();
CHECK_THROWS_AS
(
rit
.
key
(),
std
::
domain_error
);
CHECK
(
rit
.
value
()
==
json
(
23.42
));
CHECK_THROWS_AS
(
crit
.
key
(),
std
::
domain_error
);
...
...
@@ -4890,7 +4890,7 @@ TEST_CASE("iterators")
CHECK_THROWS_AS
(
cit
.
value
(),
std
::
out_of_range
);
auto
rit
=
j
.
rend
();
auto
crit
=
j
.
rend
();
auto
crit
=
j
.
c
rend
();
CHECK_THROWS_AS
(
rit
.
key
(),
std
::
domain_error
);
CHECK_THROWS_AS
(
rit
.
value
(),
std
::
out_of_range
);
CHECK_THROWS_AS
(
crit
.
key
(),
std
::
domain_error
);
...
...
@@ -6328,6 +6328,14 @@ TEST_CASE("serialization")
TEST_CASE
(
"deserialization"
)
{
SECTION
(
"stream"
)
{
std
::
stringstream
ss
;
ss
<<
"[
\"
foo
\"
,1,2,3,false,{
\"
one
\"
:1}]"
;
json
j
=
json
::
parse
(
ss
);
CHECK
(
j
==
json
({
"foo"
,
1
,
2
,
3
,
false
,
{{
"one"
,
1
}}}));
}
SECTION
(
"string"
)
{
auto
s
=
"[
\"
foo
\"
,1,2,3,false,{
\"
one
\"
:1}]"
;
...
...
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