diff --git a/R/drug_parameters.R b/R/drug_parameters.R index f5e62a27..4f205604 100644 --- a/R/drug_parameters.R +++ b/R/drug_parameters.R @@ -24,6 +24,7 @@ SP_AQ_params <- c(0.9, 0.32, 4.3, 38.1) #' @param drugs a list of drug parameters, can be set using presets #' @export set_drugs <- function(parameters, drugs) { + stopifnot(is.list(drugs)) keys <- c( 'drug_efficacy', 'drug_rel_c', diff --git a/tests/testthat/test-treatment.R b/tests/testthat/test-treatment.R index d52fc007..9e40c0da 100644 --- a/tests/testthat/test-treatment.R +++ b/tests/testthat/test-treatment.R @@ -78,3 +78,12 @@ test_that('You cannot set invalid coverages', { ) ) }) + +test_that('set_drugs errors if a list is not provided', { + parameters <- get_parameters() + expect_error( + set_drugs(parameters, AL_params), + "is.list(drugs) is not TRUE", + fixed = TRUE + ) +})