Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Double-check if covr catches all functions that we defined (user-level and anything (cpp, c, etc...)). Does it appear in the coverage report even with 0%? #106

Closed
Tracked by #104
matteodelucchi opened this issue May 22, 2024 · 3 comments · Fixed by #119
Assignees

Comments

@matteodelucchi
Copy link
Contributor

No description provided.

@j-i-l
Copy link
Collaborator

j-i-l commented Jun 23, 2024

covr reports the %-lines covered in tests in all files:

> pcov = package_coverage()
> pcov
abn Coverage: 40.43%
R/calc_node_inla_glm.R: 0.00%
R/calc_node_inla_glmm.R: 0.00%
R/fitabn_bayes.R: 0.00%
R/search_heuristic.R: 0.00%
src/abn_toolbox.cpp: 0.00%
src/irls_binomial_br.cpp: 0.00%
src/irls_binomial_fast.cpp: 0.00%
src/mi.cpp: 0.00%
src/node_binomial_marginals_rv.c: 0.00%
src/node_binomial_rv_inner.c: 0.00%
src/node_binomial_rv.c: 0.00%
src/node_gaussian_marginals_rv.c: 0.00%
src/node_gaussian_rv_inner.c: 0.00%
src/node_gaussian_rv.c: 0.00%
src/node_poisson_marginals_rv.c: 0.00%
src/node_poisson_rv_inner.c: 0.00%
src/node_poisson_rv.c: 0.00%
src/node_poisson.c: 0.00%
R/abn-methods.R: 4.93%
R/link-strength.R: 30.86%
R/build_score_cache_bayes.R: 35.87%
R/abn-infotheo.R: 40.37%
R/build_score_cache_mle.R: 52.59%
R/plot-abn.R: 52.76%
R/fitabn_mle.R: 53.41%
src/utility.c: 57.56%
src/node_binomial.c: 58.52%
R/fitabn.R: 63.55%
R/search_hillclimber.R: 72.31%
R/abn-internal.R: 72.56%
R/build_score_cache.R: 74.43%
src/fit_single_node.c: 76.47%
R/mostprobable.R: 78.79%
R/tographviz.R: 80.36%
R/validation.R: 80.43%
src/fitabn_marginals.c: 85.19%
R/getmarginals.R: 88.50%
R/abn-toolbox.R: 89.42%
R/simulateabn.R: 90.83%
src/mobius.c: 93.62%
R/markov-blanket.R: 93.94%
src/irls_poisson_fast.cpp: 95.24%
src/node_gaussian.c: 96.10%
src/mostprobable.c: 98.69%
src/buildcachematrix.c: 100.00%
src/cycles.c: 100.00%
src/irls_binomial_fast_br.cpp: 100.00%
src/irls_binomial.cpp: 100.00%
src/irls_gaussian_fast.cpp: 100.00%
src/irls_gaussian.cpp: 100.00%
src/irls_poisson.cpp: 100.00%
src/rank.cpp: 100.00%
src/searchhill.c: 100.00%

Here are the available functions listed for covr

Setting covr.record_tests=TRUE (so options(covr.record_tests=TRUE) before running package_coverage) we should be able to see what test(s) covers what line.

Considering #109: Having above report (or even better the change in coverage introduced by some pull request) in a nicely visible form on GH would indeed be helpful.

@matteodelucchi
Copy link
Contributor Author

Does it also cover tests, that are embraced with skip_on_cran()?

@j-i-l
Copy link
Collaborator

j-i-l commented Jun 24, 2024

With setting the env variable NOT_CRAN we can ignore the skip_on_cran():

> Sys.setenv(NOT_CRAN = "true")
> pcov = package_coverage()
> pcov
abn Coverage: 66.43%
src/abn_toolbox.cpp: 0.00%
src/irls_binomial_br.cpp: 0.00%
src/irls_binomial_fast.cpp: 0.00%
src/mi.cpp: 0.00%
src/node_binomial_marginals_rv.c: 0.00%
src/node_gaussian_marginals_rv.c: 0.00%
src/node_poisson_marginals_rv.c: 0.00%
src/node_poisson_rv_inner.c: 0.00%
src/node_poisson_rv.c: 0.00%
R/link-strength.R: 30.86%
R/abn-infotheo.R: 40.37%
R/search_heuristic.R: 48.67%
R/fitabn_mle.R: 56.26%
R/build_score_cache_mle.R: 56.40%
src/utility.c: 58.14%
R/build_score_cache_bayes.R: 68.09%
R/abn-methods.R: 68.31%
src/node_binomial_rv.c: 69.54%
R/fitabn_bayes.R: 72.24%
src/node_gaussian_rv.c: 72.51%
R/abn-internal.R: 72.56%
R/plot-abn.R: 74.80%
R/build_score_cache.R: 74.89%
R/search_hillclimber.R: 78.46%
R/mostprobable.R: 78.79%
R/tographviz.R: 80.36%
R/validation.R: 80.43%
R/calc_node_inla_glm.R: 81.52%
R/fitabn.R: 85.71%
R/calc_node_inla_glmm.R: 88.68%
R/getmarginals.R: 89.42%
R/abn-toolbox.R: 89.42%
R/simulateabn.R: 90.83%
src/fitabn_marginals.c: 92.59%
src/mobius.c: 93.62%
src/node_gaussian_rv_inner.c: 93.85%
R/markov-blanket.R: 93.94%
src/fit_single_node.c: 94.12%
src/node_poisson.c: 94.29%
src/irls_poisson_fast.cpp: 95.24%
src/node_gaussian.c: 96.10%
src/node_binomial.c: 96.11%
src/node_binomial_rv_inner.c: 97.05%
src/mostprobable.c: 98.69%
src/buildcachematrix.c: 100.00%
src/cycles.c: 100.00%
src/irls_binomial_fast_br.cpp: 100.00%
src/irls_binomial.cpp: 100.00%
src/irls_gaussian_fast.cpp: 100.00%
src/irls_gaussian.cpp: 100.00%
src/irls_poisson.cpp: 100.00%
src/rank.cpp: 100.00%
src/searchhill.c: 100.00%

For example fitabn_bayes which as tests that are skipped on CRAN:

R/fitabn_bayes.R: 72.24% as compared to R/fitabn_bayes.R: 0.00% before.

Basically, we want to do Sys.setenv(NOT_CRAN = "true") before assessing the code coverage.

Going to implement this in the existing workflow.

@j-i-l j-i-l linked a pull request Jun 24, 2024 that will close this issue
@j-i-l j-i-l closed this as completed in #119 Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants