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
75f4678b
Unverified
Commit
75f4678b
authored
Oct 05, 2017
by
Niels Lohmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🔨
added filter script for branch coverage
parent
c204ac82
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
786 additions
and
1 deletion
+786
-1
test/CMakeLists.txt
test/CMakeLists.txt
+3
-1
test/thirdparty/imapdl/filterbr.py
test/thirdparty/imapdl/filterbr.py
+109
-0
test/thirdparty/imapdl/gpl-3.0.txt
test/thirdparty/imapdl/gpl-3.0.txt
+674
-0
No files found.
test/CMakeLists.txt
View file @
75f4678b
...
...
@@ -41,10 +41,12 @@ if(JSON_Coverage)
find_program
(
GCOV_BIN NAMES gcov-
${
GCC_VERSION
}
gcov HINTS
${
COMPILER_PATH
}
)
# add target to collect coverage information and generate HTML file
# (filter script from https://stackoverflow.com/a/43726240/266378)
add_custom_target
(
lcov_html
COMMAND lcov --directory . --capture --output-file json.info --gcov-tool
${
GCOV_BIN
}
--rc lcov_branch_coverage=1
COMMAND lcov -e json.info
${
CMAKE_SOURCE_DIR
}
/src/json.hpp --output-file json.info.filtered --rc lcov_branch_coverage=1
COMMAND genhtml --title
"JSON for Modern C++"
--legend --demangle-cpp --output-directory html --show-details --branch-coverage json.info.filtered
COMMAND
${
CMAKE_SOURCE_DIR
}
/test/thirdparty/imapdl/filterbr.py json.info.filtered > json.info.filtered.noexcept
COMMAND genhtml --title
"JSON for Modern C++"
--legend --demangle-cpp --output-directory html --show-details --branch-coverage json.info.filtered.noexcept
COMMENT
"Generating HTML report test/html/index.html"
)
endif
()
...
...
test/thirdparty/imapdl/filterbr.py
0 → 100755
View file @
75f4678b
#!/usr/bin/env python3
# 2017, Georg Sauthoff <mail@gms.tf>, GPLv3
import
sys
def
skip_comments
(
lines
):
state
=
0
for
line
in
lines
:
n
=
len
(
line
)
l
=
''
p
=
0
while
p
<
n
:
if
state
==
0
:
a
=
line
.
find
(
'//'
,
p
)
b
=
line
.
find
(
'/*'
,
p
)
if
a
>
-
1
and
(
a
<
b
or
b
==
-
1
):
l
+=
line
[
p
:
a
]
p
=
n
elif
b
>
-
1
and
(
b
<
a
or
a
==
-
1
):
l
+=
line
[
p
:
b
]
p
=
b
+
2
state
=
1
else
:
l
+=
line
[
p
:]
p
=
n
elif
state
==
1
:
a
=
line
.
rfind
(
'*/'
,
p
)
if
a
==
-
1
:
p
=
n
else
:
p
=
a
+
2
state
=
0
yield
l
def
cond_lines
(
lines
):
state
=
0
pcnt
=
0
for
nr
,
line
in
enumerate
(
lines
,
1
):
if
not
line
:
continue
n
=
len
(
line
)
p
=
0
do_yield
=
False
while
p
<
n
:
if
state
==
0
:
p
=
line
.
find
(
'if'
,
p
)
if
p
==
-
1
:
p
=
n
continue
if
(
p
==
0
or
not
line
[
p
-
1
].
isalpha
())
\
and
(
p
+
2
==
len
(
line
)
or
not
line
[
p
+
2
].
isalpha
()):
do_yield
=
True
state
=
1
p
+=
2
elif
state
==
1
:
do_yield
=
True
p
=
line
.
find
(
'('
,
p
)
if
p
==
-
1
:
p
=
n
else
:
p
+=
1
state
=
2
pcnt
=
1
elif
state
==
2
:
do_yield
=
True
for
p
in
range
(
p
,
n
):
if
line
[
p
]
==
'('
:
pcnt
+=
1
elif
line
[
p
]
==
')'
:
pcnt
-=
1
if
not
pcnt
:
state
=
0
break
p
+=
1
if
do_yield
:
yield
nr
def
cond_lines_from_file
(
filename
):
with
open
(
filename
)
as
f
:
yield
from
cond_lines
(
skip_comments
(
f
))
def
filter_lcov_trace
(
lines
):
nrs
=
set
()
for
line
in
lines
:
if
line
.
startswith
(
'SF:'
):
nrs
=
set
(
cond_lines_from_file
(
line
[
3
:
-
1
]))
elif
line
.
startswith
(
'BRDA:'
):
xs
=
line
[
5
:].
split
(
','
)
nr
=
int
(
xs
[
0
])
if
xs
else
0
if
nr
not
in
nrs
:
continue
yield
line
def
filter_lcov_trace_file
(
s_filename
,
d_file
):
with
open
(
s_filename
)
as
f
:
for
l
in
filter_lcov_trace
(
f
):
print
(
l
,
end
=
''
,
file
=
d_file
)
if
__name__
==
'__main__'
:
#for l in cond_lines_from_file(sys.argv[1]):
# print(l)
filter_lcov_trace_file
(
sys
.
argv
[
1
],
sys
.
stdout
)
#with open(sys.argv[1]) as f:
# for l in skip_comments(f):
# print(l)
test/thirdparty/imapdl/gpl-3.0.txt
0 → 100644
View file @
75f4678b
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