Skip to content

Commit

Permalink
Add tests for effect of cumulative contact intervs, WIP #187
Browse files Browse the repository at this point in the history
  • Loading branch information
pratikunterwegs committed Mar 14, 2024
1 parent 07014c0 commit ab85b91
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/testthat/test-model_default.R
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,28 @@ test_that("Default model: contacts interventions and stats. correctness", {
expect_true(
all(epidemic_size(data_baseline) > epidemic_size(data))
)

# expect model runs with multiple contacts interventions
# expect that effect of multiple interventions is greater than single
intervention_02 <- intervention(
"work_closure", "contacts", 0, time_end, c(0.1, 0.5)
)
combined_interventions <- c(intervention, intervention_02)

expect_no_condition(
model_default(
uk_population,
intervention = list(contacts = combined_interventions)
)
)
data_combined <- model_default(
uk_population,
intervention = list(contacts = combined_interventions)
)
# expect epidemic size is lower for combined intervention
expect_true(
all(epidemic_size(data_combined) < epidemic_size(data))
)
})

test_that("Default model: rate interventions", {
Expand Down
22 changes: 22 additions & 0 deletions tests/testthat/test-model_vacamole.R
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,28 @@ test_that("Vacamole model: contacts interventions and stats. correctness", {
expect_true(
all(epidemic_size(data_baseline) > epidemic_size(data))
)

# expect model runs with multiple contacts interventions
# expect that effect of multiple interventions is greater than single
intervention_02 <- intervention(
"work_closure", "contacts", 0, time_end, c(0.1, 0.5)
)
combined_interventions <- c(intervention, intervention_02)

expect_no_condition(
model_vacamole(
uk_population,
intervention = list(contacts = combined_interventions)
)
)
data_combined <- model_vacamole(
uk_population,
intervention = list(contacts = combined_interventions)
)
# expect epidemic size is lower for combined intervention
expect_true(
all(epidemic_size(data_combined) < epidemic_size(data))
)
})

test_that("Vacamole model: rate interventions", {
Expand Down

0 comments on commit ab85b91

Please sign in to comment.