Skip to content

Commit

Permalink
add unit test for negative infectious period in .sim_network_bp, rela…
Browse files Browse the repository at this point in the history
…tes #141
  • Loading branch information
joshwlambert committed Jun 17, 2024
1 parent 6a9a664 commit 078c348
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/testthat/test-sim_network_bp.R
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,27 @@ test_that(".sim_network_bp warns as expected", {
regexp = "(Number of cases exceeds maximum)*(Returning data early)"
)
})

test_that(".sim_network_bp errors with negative infectious period", {
suppressMessages({
infect_period <- as.function(
epiparameter::epidist(
disease = "COVID-19",
epi_dist = "infectious period",
prob_distribution = "norm",
prob_distribution_params = c(mean = 10, sd = 5)
), func_type = "generate"
)
})
set.seed(3)
expect_error(
.sim_network_bp(
contact_distribution = contact_distribution,
infect_period = infect_period,
prob_infect = 0.5,
max_outbreak_size = 1e4,
config = create_config()
),
regexp = "(Negative infectious period sampled)"
)
})

0 comments on commit 078c348

Please sign in to comment.