RXR-2598: consolidate model compilation & tests#132
Merged
roninsightrx merged 10 commits intomasterfrom Jan 22, 2026
Merged
Conversation
Move shared model compilations from individual test files to setup.R to reduce redundant compilation during test runs. Models are compiled once at test session startup and reused across test files. Models moved include IOV models, multi-observation models, mixture models, time-varying covariate models, and various library models (3cmt, 2cmt oral, MM kinetics). Conditional compilation (NOT_CRAN) preserved for slower models. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR consolidates model compilations and reorganizes test files to improve test organization and reduce compilation time during testing. Models that were previously compiled separately in individual test files are now compiled once in setup.R, and tests have been reorganized to follow a test_<function> naming convention.
Changes:
- Models consolidated into
setup.Rfor one-time compilation at test session startup - Tests from multiple files (test_iov.R, test_multi_obs.R, test_mixture_model.R, test_compare_results.R, test_cmt_mapping.R, test_timevar_cov.R, test_t_init.R, test_sim_lagtime.R, test_time_rounding_bug.R) moved into test_sim.R
- Tests from test_bioav_def.R moved into test_new_ode_model.R
- Tests from test_advan_with_auc.R and test_advan_with_covariates.R consolidated into test_advan.R
- New test files created for specific functions (test_new_adherence.R, test_check_mixture_model.R, test_calculate_parameters.R, test_pkpdsim_to_nlmixr.R)
- New R implementation file R/new_adherence.R added with adherence simulation functions
Reviewed changes
Copilot reviewed 22 out of 26 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/testthat/setup.R | Centralized model compilation with clear organization and comments |
| tests/testthat/test_sim.R | Consolidated tests from multiple files into describe() blocks |
| tests/testthat/test_new_ode_model.R | Added IOV and bioavailability tests from test_bioav_def.R |
| tests/testthat/test_advan.R | Added AUC and covariate tests from separate files |
| tests/testthat/test_new_adherence.R | New test file for adherence functions |
| tests/testthat/test_check_mixture_model.R | New test file extracted from test_mixture_model.R |
| tests/testthat/test_calculate_parameters.R | New test file for parameter calculation |
| tests/testthat/test_pkpdsim_to_nlmixr.R | New test file for nlmixr conversion |
| R/new_adherence.R | New implementation of adherence simulation functions |
| tests/testthat/test_get_var_y.R | Added seed parameters for reproducibility |
| tests/testthat/test_reparametrization.R | Updated to use models from setup.R |
| tests/testthat/test_parameters_table.R | Updated to use models from setup.R |
| tests/testthat/test_calc_ss_analytic.R | Updated to use models from setup.R |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
mccarthy-m-g
approved these changes
Jan 20, 2026
Contributor
mccarthy-m-g
left a comment
There was a problem hiding this comment.
lgtm! Nice clean up 🧹
tests/testthat/test_advan.R
Outdated
Comment on lines
299
to
301
| ## there is slight difference in how bolus doses are handled. | ||
| ## Analytical equation is perhaps more consistent, so not testing | ||
| ## simulations at dose times. Should look into later. |
Contributor
There was a problem hiding this comment.
Maybe add a TODO here?
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.
test_<function>(some where grouped more by topic).No changes to actual code, just tests.