Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
I
IQC.Jl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Package registry
Operate
Terraform modules
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Johan Grönqvist
IQC.Jl
Commits
a07e80f9
Commit
a07e80f9
authored
10 months ago
by
Johan Grönqvist
Browse files
Options
Downloads
Patches
Plain Diff
Add code coverage testing
parent
d2b2cf71
Branches
Branches containing commit
No related tags found
Loading
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitignore
+1
-0
1 addition, 0 deletions
.gitignore
Project.toml
+2
-0
2 additions, 0 deletions
Project.toml
test/coverage.jl
+79
-0
79 additions, 0 deletions
test/coverage.jl
with
82 additions
and
0 deletions
.gitignore
+
1
−
0
View file @
a07e80f9
...
@@ -17,3 +17,4 @@
...
@@ -17,3 +17,4 @@
/src/NeuralNetworks.ipynb
/src/NeuralNetworks.ipynb
/examples/random_systems.ipynb
/examples/random_systems.ipynb
/examples/ToolboxExamples.ipynb
/examples/ToolboxExamples.ipynb
/test/coverage.ipynb
This diff is collapsed.
Click to expand it.
Project.toml
+
2
−
0
View file @
a07e80f9
...
@@ -6,6 +6,7 @@ version = "0.1.1"
...
@@ -6,6 +6,7 @@ version = "0.1.1"
[deps]
[deps]
BlockArrays
=
"8e7c35d0-a365-5155-bbbb-fb81a777f24e"
BlockArrays
=
"8e7c35d0-a365-5155-bbbb-fb81a777f24e"
ControlSystems
=
"a6e380b2-a6ca-5380-bf3e-84a91bcd477e"
ControlSystems
=
"a6e380b2-a6ca-5380-bf3e-84a91bcd477e"
Coverage
=
"a2441757-f6aa-5fb2-8edb-039e3f45d037"
Flux
=
"587475ba-b771-5e3f-ad9e-33799f191a9c"
Flux
=
"587475ba-b771-5e3f-ad9e-33799f191a9c"
Hypatia
=
"b99e6be6-89ff-11e8-14f8-45c827f4f8f2"
Hypatia
=
"b99e6be6-89ff-11e8-14f8-45c827f4f8f2"
IntervalArithmetic
=
"d1acc4aa-44c8-5952-acd4-ba5d80a2a253"
IntervalArithmetic
=
"d1acc4aa-44c8-5952-acd4-ba5d80a2a253"
...
@@ -18,6 +19,7 @@ MosekTools = "1ec41992-ff65-5c91-ac43-2df89e9693a4"
...
@@ -18,6 +19,7 @@ MosekTools = "1ec41992-ff65-5c91-ac43-2df89e9693a4"
NNlib
=
"872c559c-99b0-510c-b3b7-b6c96a88d5cd"
NNlib
=
"872c559c-99b0-510c-b3b7-b6c96a88d5cd"
Optim
=
"429524aa-4258-5aef-a3af-852621145aeb"
Optim
=
"429524aa-4258-5aef-a3af-852621145aeb"
OrderedCollections
=
"bac558e1-5e72-5ebc-8fee-abe8a469f55d"
OrderedCollections
=
"bac558e1-5e72-5ebc-8fee-abe8a469f55d"
Pkg
=
"44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
Plots
=
"91a5bcdd-55d7-5caf-9e0b-520d859cae80"
Plots
=
"91a5bcdd-55d7-5caf-9e0b-520d859cae80"
Polynomials
=
"f27b6e38-b328-58d1-80ce-0feddd5e7a45"
Polynomials
=
"f27b6e38-b328-58d1-80ce-0feddd5e7a45"
Printf
=
"de0858da-6303-5e67-8744-51eddeeeb8d7"
Printf
=
"de0858da-6303-5e67-8744-51eddeeeb8d7"
...
...
This diff is collapsed.
Click to expand it.
test/coverage.jl
0 → 100644
+
79
−
0
View file @
a07e80f9
# -*- coding: utf-8 -*-
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .jl
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.16.4
# kernelspec:
# display_name: Julia 1.10.2
# language: julia
# name: julia-1.10
# ---
# %% [markdown]
# # Prelude
# %%
import
Pkg
Pkg
.
activate
(
".."
)
Pkg
.
instantiate
()
# %%
using
Coverage
using
Base
.
Filesystem
# %% [markdown]
# # Run tests, Collecting stats
# %%
for
(
d
,
ds
,
fs
)
in
walkdir
(
"../src"
)
for
f
in
fs
if
endswith
(
f
,
".cov"
)
rm
(
"
$(d)
/
$(f)
"
)
end
end
end
# %%
Pkg
.
test
(
"IQC"
;
coverage
=
true
)
# %%
coverage
=
process_folder
(
"../src"
)
# defaults to src/; alternatively, supply the folder name as argument
coverage
=
[
c
for
c
in
coverage
if
!
occursin
(
"ipynb_checkpoints"
,
c
.
filename
)
];
# %% [markdown]
# # Per file summary statistics
# %%
for
cov
in
coverage
good
=
length
([
c
for
c
in
cov
.
coverage
if
!
isnothing
(
c
)
&&
!
iszero
(
c
)
])
total
=
length
([
c
for
c
in
cov
.
coverage
if
!
isnothing
(
c
)
])
println
(
"
$
(split(cov.filename, "
/
")[end]):
$(good)
/
$(total)
"
)
end
# %% [markdown]
# # Untested Functions and Macros
# %%
re_macro
=
r
"^macro .*"
re_function
=
r
"^function .*"
re_function_short
=
r
"^[A-Za-z0-9z.]*\(.*\).*="
# %%
for
cov
in
coverage
println
(
"File:
$
(cov.filename)"
)
for
(
c
,
ℓ
)
in
zip
(
cov
.
coverage
,
split
(
cov
.
source
,
"
\n
"
))
if
isnothing
(
c
)
||
iszero
(
c
)
if
occursin
(
re_macro
,
ℓ
)
||
occursin
(
re_function
,
ℓ
)
||
occursin
(
re_function_short
,
ℓ
)
println
(
ℓ
)
end
end
end
end
# %%
# %%
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment