Repository navigation
Test suite: testthat edition 3, numerical validation, coverage 80% to 93% (#215) - #246
Merged
Merged
Conversation
- Config/testthat/edition: 3 in DESCRIPTION. - Remove the 18 context() calls and convert the 41 expect_is() calls to expect_s3_class(); both are deprecated in edition 3. - Rename tests/testthat/util_models_detfun.R to helper-models.R, which testthat loads automatically, instead of source()-ing it. - test_elc.R: check.names (an all.equal() argument) becomes ignore_attr, and the reference calculation breaks max.col() ties with 'first', as the package does since #167. All 263 expectations pass with no warnings.
Numerical validation: - beta_params(), gamma_params() (scale and rate), lnorm_params(), and dirichlet_params() reproduce the requested mean and spread exactly. - gen_psa_samp(): every distribution and parameterization (normal, both log-normal forms, truncated normal, both beta and gamma forms, all three Dirichlet forms, bootstrap, triangle, constant) gives samples with the expected moments (n = 20,000, fixed seed). Branch coverage (each test checks what the option changes): - test_plot_options.R: plot.psa() center/ellipse/col/ref options, plot.ceac() frontier/points/min_prob, the three plot.evsi() layouts, plot.evppi(), owsa_tornado() data/filter/two-strategy comparison. - summary.metamodel() (one-way lm and gam, two-way, multiway error) and print.metamodel(). - run_psa(): params_basecase, strategies taken from FUN, FUN output checks, progress output. Coverage (covr): 79.97% -> 93.08%.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #246 +/- ##
===========================================
+ Coverage 79.96% 93.08% +13.11%
===========================================
Files 18 18
Lines 1822 1822
===========================================
+ Hits 1457 1696 +239
+ Misses 365 126 -239 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #215
testthat edition 3 (commit 1)
Config/testthat/edition: 3in DESCRIPTION.context()calls and converted the 41expect_is()calls toexpect_s3_class(). Both are deprecated in edition 3.util_models_detfun.R→helper-models.R, which testthat loads automatically, so it no longer needs to besource()d.test_elc.R:check.names(anall.equal()argument) becomesignore_attr. Its reference calculation now breaksmax.col()ties with"first", as the package does since CEAC max.col returns random indices #167.All 263 existing expectations pass with no warnings.
Numerical validation (commit 2)
beta_params(),gamma_params()(scale and rate forms),lnorm_params(), anddirichlet_params().gen_psa_samp(): every distribution and parameterization gives samples with the expected moments (n = 20,000, fixed seed):calc_evpi()matches BCEA's EVPI to within 1e-8, this gives external checks of the core calculations for the JOSS paper.Branch coverage
Each new test checks what an option changes, not just that the code runs:
test_plot_options.R):plot.psa()with center, ellipse, color, reference axes and caption options;plot.ceac()withfrontier,pointsandmin_prob(strategies below the threshold are dropped);plot.evsi()layouts, by sample size, WTP, or both;plot.evppi();owsa_tornado()'s returned data, relative-difference filter and two-strategy comparison.summary.metamodel()(one-way lm and GAM, two-way, and the multiway error) andprint.metamodel().run_psa():params_basecase, strategy names taken fromFUN, checks onFUN's output, and progress output.Coverage (covr)
79.97% → 93.08%. The lowest file is now
dsa_twoway.Rat 77.8%; all others are at 85% or more. Codecov will confirm the number on this PR.Verification
main. Only test files and DESCRIPTION change.R CMD check --as-cran: 0 errors, 0 warnings, 1 NOTE (the development version number).Not included
hund_strat: I don't have the reference table. If someone shares it, it's a short test to add.