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
b30e9ee5
Commit
b30e9ee5
authored
Jan 13, 2015
by
Niels
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test cases to cover 100% of the fix of #28
parent
19043d20
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
12 deletions
+32
-12
test/json_unit.cc
test/json_unit.cc
+32
-12
No files found.
test/json_unit.cc
View file @
b30e9ee5
...
@@ -294,12 +294,22 @@ TEST_CASE("array")
...
@@ -294,12 +294,22 @@ TEST_CASE("array")
SECTION
(
"Iterators and empty arrays"
)
SECTION
(
"Iterators and empty arrays"
)
{
{
json
j
(
json
::
value_type
::
array
);
json
empty_array
(
json
::
value_type
::
array
);
for
(
json
::
iterator
it
=
j
.
begin
();
it
!=
j
.
end
();
++
it
)
{}
for
(
json
::
iterator
it
=
empty_array
.
begin
();
it
!=
empty_array
.
end
();
++
it
)
{}
for
(
json
::
const_iterator
it
=
j
.
begin
();
it
!=
j
.
end
();
++
it
)
{}
for
(
json
::
const_iterator
it
=
empty_array
.
begin
();
it
!=
empty_array
.
end
();
++
it
)
{}
for
(
json
::
const_iterator
it
=
j
.
cbegin
();
it
!=
j
.
cend
();
++
it
)
{}
for
(
json
::
const_iterator
it
=
empty_array
.
cbegin
();
it
!=
empty_array
.
cend
();
++
it
)
{}
for
(
auto
el
:
j
)
{}
for
(
auto
el
:
empty_array
)
{}
for
(
const
auto
el
:
j
)
{}
for
(
const
auto
el
:
empty_array
)
{}
// create nonempty array, set iterators, clear array, and copy
// existing iterators to cover copy constructor's code
json
array
=
{
1
,
2
,
3
};
json
::
iterator
i1
=
array
.
begin
();
json
::
const_iterator
i2
=
array
.
cbegin
();
array
.
clear
();
json
::
iterator
i3
(
i1
);
json
::
const_iterator
i4
(
i1
);
json
::
const_iterator
i5
(
i2
);
}
}
}
}
...
@@ -687,12 +697,22 @@ TEST_CASE("object")
...
@@ -687,12 +697,22 @@ TEST_CASE("object")
SECTION
(
"Iterators and empty objects"
)
SECTION
(
"Iterators and empty objects"
)
{
{
json
j
(
json
::
value_type
::
object
);
json
empty_object
(
json
::
value_type
::
object
);
for
(
json
::
iterator
it
=
j
.
begin
();
it
!=
j
.
end
();
++
it
)
{}
for
(
json
::
iterator
it
=
empty_object
.
begin
();
it
!=
empty_object
.
end
();
++
it
)
{}
for
(
json
::
const_iterator
it
=
j
.
begin
();
it
!=
j
.
end
();
++
it
)
{}
for
(
json
::
const_iterator
it
=
empty_object
.
begin
();
it
!=
empty_object
.
end
();
++
it
)
{}
for
(
json
::
const_iterator
it
=
j
.
cbegin
();
it
!=
j
.
cend
();
++
it
)
{}
for
(
json
::
const_iterator
it
=
empty_object
.
cbegin
();
it
!=
empty_object
.
cend
();
++
it
)
{}
for
(
auto
el
:
j
)
{}
for
(
auto
el
:
empty_object
)
{}
for
(
const
auto
el
:
j
)
{}
for
(
const
auto
el
:
empty_object
)
{}
// create nonempty object, set iterators, clear object, and copy
// existing iterators to cover copy constructor's code
json
object
=
{{
"foo"
,
1
}};
json
::
iterator
i1
=
object
.
begin
();
json
::
const_iterator
i2
=
object
.
cbegin
();
object
.
clear
();
json
::
iterator
i3
(
i1
);
json
::
const_iterator
i4
(
i1
);
json
::
const_iterator
i5
(
i2
);
}
}
}
}
...
...
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