Skip to content

Commit

Permalink
added tests for clean_epidist_params bug fix, relates #161
Browse files Browse the repository at this point in the history
  • Loading branch information
joshwlambert committed Aug 18, 2023
1 parent 14b6b31 commit ce1d2fe
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tests/testthat/test-epidist_utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,33 @@ test_that("clean_epidist_params works for default method", {
)
})

test_that("clean_epidist_params works for unparameterised (NA), (#161)", {
params <- NA
class(params) <- "gamma"
res <- clean_epidist_params(prob_dist_params = params)
expect_identical(res, c(shape = NA, scale = NA))

class(params) <- "lnorm"
res <- clean_epidist_params(prob_dist_params = params)
expect_identical(res, c(meanlog = NA, sdlog = NA))

class(params) <- "weibull"
res <- clean_epidist_params(prob_dist_params = params)
expect_identical(res, c(shape = NA, scale = NA))

class(params) <- "nbinom"
res <- clean_epidist_params(prob_dist_params = params)
expect_identical(res, c(mean = NA, dispersion = NA))

class(params) <- "geom"
res <- clean_epidist_params(prob_dist_params = params)
expect_identical(res, c(prob = NA))

class(params) <- "pois"
res <- clean_epidist_params(prob_dist_params = params)
expect_identical(res, c(mean = NA))
})

test_that("create_epidist_region works as expected", {
region <- create_epidist_region(
continent = "Europe",
Expand Down

0 comments on commit ce1d2fe

Please sign in to comment.