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

698 improve test coverage in design methodsr #704

Merged
merged 15 commits into from
Nov 20, 2023

Conversation

Puzzled-Face
Copy link
Collaborator

@Puzzled-Face Puzzled-Face commented Oct 11, 2023

This PR increases test coverage from 15% to 72%.

Generally speaking, code dealing with placebo and sentinel patients is not currently covered.

  • simulate-DualDesign appears to produce inconsistent results
  • simulate-DADesign appears to produce inconsistent results
  • simulate-DualResponsesSamplesDesign is almost 1000 lines long

Next steps are to move design generation code into helper functions and generalise to allow for the inclusion of placebo patients.

@Puzzled-Face Puzzled-Face linked an issue Oct 11, 2023 that may be closed by this pull request
@Puzzled-Face Puzzled-Face enabled auto-merge (squash) October 11, 2023 13:08
@github-actions
Copy link
Contributor

github-actions bot commented Oct 11, 2023

badge

Code Coverage Summary

Filename                    Stmts    Miss  Cover    Missing
------------------------  -------  ------  -------  ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
R/checkmate.R                  73       1  98.63%   72
R/crmPack-package.R             4       0  100.00%
R/CrmPackClass-methods.R        5       0  100.00%
R/Data-class.R                147       5  96.60%   43, 564-565, 571-576
R/Data-methods.R              203       0  100.00%
R/Data-validity.R             144       1  99.31%   21
R/Design-class.R              321       0  100.00%
R/Design-methods.R           2788     779  72.06%   154-158, 174-181, 659-663, 687-690, 698-717, 722-751, 755-756, 758, 773-781, 785, 797-816, 1215-1219, 1346, 1360-1364, 1426, 1616, 1833, 1860-1863, 1872-1883, 1887-1906, 1917-1921, 1927-1939, 2194, 2219-2222, 2229-2240, 2244-2263, 2275-2279, 2285-2297, 2571-2574, 2602-2605, 2613-2625, 2628-2639, 2643-2679, 2696-2705, 2711-2726, 2751, 2792-2793, 3046-3508, 3603-3614, 3617-3628, 3632-3668, 3685-3694, 3702-3717, 3755, 3797-3798, 4069, 4071-4072, 4131, 4167, 4204-4207, 4226-4230, 4291-4298, 4326-4330, 4338-4356, 4382-4401, 4404, 4437, 4459-4477, 4711, 4805
R/Design-validity.R            28       0  100.00%
R/fromQuantiles.R             176      67  61.93%   238-378
R/helpers_broom.R              74      10  86.49%   30, 34-35, 37-38, 40, 81, 102-104
R/helpers_covr.R               23       0  100.00%
R/helpers_data.R               84       1  98.81%   139
R/helpers_design.R             75      35  53.33%   77-129
R/helpers_jags.R               77       0  100.00%
R/helpers_model.R              78       4  94.87%   38, 89-90, 139
R/helpers_rules.R             428       0  100.00%
R/helpers_simulations.R        18       0  100.00%
R/helpers.R                   224      61  72.77%   107-127, 162-178, 200-304, 339-353
R/logger.R                     11       0  100.00%
R/mcmc.R                      287      18  93.73%   92-97, 376-377, 387, 389-390, 393-396, 579-580, 669, 675, 733
R/McmcOptions-class.R          22       0  100.00%
R/McmcOptions-methods.R         8       1  87.50%   43
R/McmcOptions-validity.R       42       0  100.00%
R/Model-class.R              1062     166  84.37%   145-147, 216-218, 222-224, 283-285, 357-359, 363-365, 444-446, 513-515, 577-581, 584-587, 690-693, 697-698, 813-817, 937-939, 943-951, 1096-1098, 1103-1106, 1110-1113, 1229-1233, 1235-1238, 1242-1245, 1248, 1409-1419, 1424-1430, 1585-1588, 1594-1601, 1758, 1767, 1776, 1785, 1794-1799, 1935, 1944, 1953, 1961-1963, 2807-2836, 2840-2846, 2853-2857, 2862, 2969-2982, 3008, 3104-3106, 3110, 3203-3205, 3209, 3278-3290, 3308, 3367-3369, 3371-3372, 3375-3380
R/Model-methods.R             418      32  92.34%   78, 710-755, 1076-1085
R/Model-validity.R            435       8  98.16%   430-433, 442-445
R/ModelParams-class.R          17       0  100.00%
R/ModelParams-validity.R       21       0  100.00%
R/Rules-class.R               431       2  99.54%   3150, 3231
R/Rules-methods.R            1482     166  88.80%   889, 892, 895, 1010, 1013, 1016, 1136-1139, 1173, 1276-1279, 1314, 2477-2485, 2509-2516, 3019-3262, 3531, 3535, 3580, 3584
R/Rules-validity.R            418       0  100.00%
R/Samples-class.R               6       0  100.00%
R/Samples-methods.R          1188      47  96.04%   405-415, 643, 1413-1448, 1660-1661, 1693, 1706, 1888, 2218-2223
R/Samples-validity.R           10       0  100.00%
R/Simulations-class.R         199       5  97.49%   770-773, 1028
R/Simulations-methods.R      1604    1460  8.98%    65-350, 406, 416-435, 448-453, 500-509, 675-2944
R/Simulations-validity.R       75      75  0.00%    20-168
R/utils.R                       6       0  100.00%
TOTAL                       12712    2944  76.84%

Diff against main

Filename                 Stmts    Miss  Cover
---------------------  -------  ------  -------
R/Design-methods.R           0   -1096  +39.31%
R/Model-methods.R            0      -2  +0.48%
R/Rules-methods.R            0      -2  +0.13%
R/Samples-methods.R        +35      +2  -0.05%
R/Simulations-class.R        0     -24  +12.06%
TOTAL                      +35   -1122  +8.91%

Results for commit: 54a3b1f

Minimum allowed coverage is 80%

♻️ This comment has been updated with latest results

Merge branch '698-improve-test-coverage-in-design-methodsr' of github.com:Roche/crmPack into 698-improve-test-coverage-in-design-methodsr

# Conflicts:
#	tests/testthat/test-Design-methods.R
Merge branch '698-improve-test-coverage-in-design-methodsr' of github.com:Roche/crmPack into 698-improve-test-coverage-in-design-methodsr

# Conflicts:
#	tests/testthat/test-Design-methods.R
@github-actions
Copy link
Contributor

github-actions bot commented Oct 11, 2023

Unit Tests Summary

       1 files       38 suites   3m 10s ⏱️
1 214 tests 1 061 ✔️ 153 💤 0
6 502 runs  6 311 ✔️ 191 💤 0

Results for commit 54a3b1f.

♻️ This comment has been updated with latest results.

Copy link
Collaborator

@danielinteractive danielinteractive left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @Puzzled-Face for the initiative, much appreciated - please see comments below

tests/testthat/test-Design-methods.R Outdated Show resolved Hide resolved
tests/testthat/test-Design-methods.R Outdated Show resolved Hide resolved
tests/testthat/test-Design-methods.R Outdated Show resolved Hide resolved
tests/testthat/test-Design-methods.R Outdated Show resolved Hide resolved
tests/testthat/_snaps/Design-methods.md Show resolved Hide resolved
Puzzled-Face and others added 4 commits November 20, 2023 14:32
Merge remote-tracking branch 'origin/main' into 698-improve-test-coverage-in-design-methodsr

# Conflicts:
#	tests/testthat/_snaps/Design-methods.md
#	tests/testthat/test-Design-methods.R
Copy link
Contributor

Unit Test Performance Difference

Test Suite $Status$ Time on main $±Time$ $±Tests$ $±Skipped$ $±Failures$ $±Errors$
CrmPackClass-class 💔 $22.07$ $+10.24$ $0$ $0$ $0$ $0$
CrmPackClass-methods 💚 $22.38$ $-2.67$ $0$ $0$ $0$ $0$
Design-methods 💔 $21.62$ $+10.12$ $+11$ $+11$ $0$ $0$
Rules-methods 💚 $50.79$ $-4.03$ $0$ $0$ $0$ $0$
Additional test case details
Test Suite $Status$ Time on main $±Time$ Test Case
CrmPackClass-class 💔 $21.92$ $+10.24$ CrmPackClass_correctly_identifies_crmPack_classes
CrmPackClass-methods 💚 $22.38$ $-2.67$ tidy_methods_exist_for_all_relevant_classes
Design-methods 👶 $+3.24$ examine_produces_consistent_results
Design-methods 👶 $+2.32$ examine_produces_consistent_results_with_placebo_data
Design-methods 👶 $+0.72$ simulate_DualDesign_produces_consistent_results
Design-methods 👶 $+2.01$ simulate_DualResponsesDesign_produces_consistent_results
Design-methods 👶 $+0.30$ simulate_DualResponsesSamplesDesign_produces_consistent_results
Design-methods 👶 $+0.20$ simulate_RuleDesign_produces_consistent_results
Design-methods 👶 $+0.47$ simulate_TDDesign_produces_consistent_results
Design-methods 👶 $+0.33$ simulate_TDSamplesDesign_produces_consistent_results
Design-methods 👶 $+0.62$ simulate_produces_consistent_results_with_placebo_data
Design-methods 👶 $+0.83$ simulate_produces_consistent_results_with_sentinel_patients
Rules-methods 💚 $15.18$ $-1.46$ stopTrial_works_correctly_for_StoppingTDCIRatio_when_samples_are_not_provided

Results for commit ddf0b83

♻️ This comment has been updated with latest results.

@Puzzled-Face Puzzled-Face merged commit 4b3df24 into main Nov 20, 2023
21 checks passed
@Puzzled-Face Puzzled-Face deleted the 698-improve-test-coverage-in-design-methodsr branch November 20, 2023 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Improve test coverage in Design-methods.R
2 participants