epiverse-trace / epiparameter

R package with library of epidemiological parameters for infectious diseases and functions and classes for working with parameters
https://epiverse-trace.github.io/epiparameter
Other
33 stars 11 forks source link

Refactor `test_epiparameter()` & `assert_epiparameter()` #402

Closed joshwlambert closed 1 month ago

joshwlambert commented 1 month ago

This PR refactors the test_epiparameter() and assert_epiparameter() functions by pulling out the body of each function and merging in a new .validate_epiparameter() function, which is called by each of the exported functions.

If .validate_epiparameter() finds invalid components of <epiparameter> objects it surfaces messages which test_epiparameter() and assert_epiparameter() use to message or error with, respectively.

The unit tests of test_epiparameter() and assert_epiparameter() have also been simplified.

Unifying the bodies of test_epiparameter() and assert_epiparameter() was suggested in #394.