Skip to content

Commit

Permalink
update design_effect() tests: expect failure for extreme values
Browse files Browse the repository at this point in the history
  • Loading branch information
AngusMcLure committed Dec 5, 2023
1 parent 0297836 commit 0426432
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions tests/testthat/test-design_effect.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ test_that("design_effect() gives consistent output for basic tests", {
26.50055,
tolerance = 1e-5
)
expect_equal(
})

test_that("design_effect() fails for some very unusual parameters because integral in call to fi_pool_cluster() appears starts to have numeric issues", {
expect_error(
design_effect(
pool_size = 100,
pool_number = 10,
Expand All @@ -46,11 +49,11 @@ test_that("design_effect() gives consistent output for basic tests", {
correlation = 0.8,
form = "cloglognorm"
),
4422,
tolerance = 1e-4
"Error in integration of likelihoods. Likelihoods do not add to 1 or derivatives of likelihood with respect to parameters do not sum to 0"
)
})


test_that("bad inputs caught in design_effect()", {
expect_error(design_effect(pool_size = TRUE), "TRUE is a logical")
expect_error(design_effect(pool_size = 5, pool_number = 10, prevalence = 10), "10 is > 1")
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-fisher_information.R
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ test_that("fi_pool_cluster() when s != 1 and form = discrete", {
})

# Integration fails ------------------------------------------------------------
test_that("fi_pool_cluster() fails when integral is divergent", {
test_that("fi_pool_cluster() fails when integral input parameters are so extreme such that the integral appears divergent", {
expect_error(
fi_pool_cluster(
pool_size = c(10, 20),
Expand Down

0 comments on commit 0426432

Please sign in to comment.