diff --git a/tests/testthat/test-output.R b/tests/testthat/test-output.R index 91d427e4..5cef37b9 100644 --- a/tests/testthat/test-output.R +++ b/tests/testthat/test-output.R @@ -17,15 +17,17 @@ test_that('Test age parameter function works', { sim <- run_simulation(timesteps = 1, parameters) - expect_true( - all( - paste0(rep(c("n_age", - "n", "n_inc", "p_inc", - "n","n_inc_clinical","p_inc_clinical", - "n","n_inc_severe","p_inc_severe", - "n","n_detect_lm","p_detect_lm","n_detect_pcr", - "ica_mean", "icm_mean","id_mean","ib_mean","iva_mean","ivm_mean"), each = 3),"_", - age_limits[-4]+rep(c(0,rep(c(1:3), each = 3), rep(4, 4), 5:10), each = 3),"_",age_limits[-1]-1+rep(c(0,rep(c(1:3), each = 3), rep(4, 4), 5:10), each = 3) - ) %in% - names(sim))) + prefixes <- c("n_age", + "n_inc", "p_inc", + "n_inc_clinical","p_inc_clinical", + "n_inc_severe","p_inc_severe", + "n_detect_lm","p_detect_lm","n_detect_pcr", + "ica_mean", "icm_mean","id_mean","ib_mean","iva_mean","ivm_mean") + offsets <- c(0, rep(1, 2), rep(2, 2), rep(3, 2), rep(4, 3), 5:10) + expect_equal(length(prefixes), length(offsets)) + + expected <- paste0(rep(prefixes, each = 3), + "_", age_limits[-4]+rep(offsets, each = 3), + "_", age_limits[-1]-1+rep(offsets, each = 3)) + expect_in(expected, names(sim)) })