diff options
Diffstat (limited to 'tests/testthat/test_parboot.R')
-rw-r--r-- | tests/testthat/test_parboot.R | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/testthat/test_parboot.R b/tests/testthat/test_parboot.R index 33a620b..175d0c3 100644 --- a/tests/testthat/test_parboot.R +++ b/tests/testthat/test_parboot.R @@ -68,6 +68,21 @@ test_that("parboot handles failing model fits", { set.seed(123) expect_warning(pb <- parboot(fm, nsim=20, statistic=fail_func)) expect_equal(nrow(pb@t.star), 13) + + # Error message when all parboot samples are bad + + # force error only when running function on new simulated datasets, + # but not for original dataset + fail_func <- function(x){ + if(round(x@AIC, 5) == 23.29768){ + return(0) + } else { + stop("fail") + } + } + + set.seed(123) + expect_error(pb2 <- parboot(fm, nsim=20, statistic=fail_func)) }) test_that("parboot handles failing model fits in parallel", { |