Skip to content

Commit

Permalink
Add test of dt setting
Browse files Browse the repository at this point in the history
  • Loading branch information
richfitz committed Jan 19, 2021
1 parent a655193 commit 4d73b83
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/testthat/test-parameters.R
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,19 @@ test_that("can expand beta", {
beta3 <- sircovid_parameters_beta_expand(t3, beta)
expect_equal(beta3, beta[1:65])
})


test_that("can change dt", {
expect_equal(sircovid_parameters_shared(0, "uk", NULL, NULL)$dt, 0.25)
expect_equal(sircovid_parameters_shared(0, "uk", NULL, NULL, 10)$dt, 0.1)
expect_equal(sircovid_parameters_shared(0, "uk", NULL, NULL, 1)$dt, 1)
expect_error(
sircovid_parameters_shared(0, "uk", NULL, NULL, 0),
"'steps_per_day' must be at least 1")
expect_error(
sircovid_parameters_shared(0, "uk", NULL, NULL, 0:1),
"'steps_per_day' must be a scalar")
expect_error(
sircovid_parameters_shared(0, "uk", NULL, NULL, 1.5),
"'steps_per_day' must be an integer")
})

0 comments on commit 4d73b83

Please sign in to comment.