tests/testthat/test_bootClassic.R

# Tests for bootClassic --------------------------------------------------------

boot <- boot_bw_sample_clusters(
  indicatorsHH, boot_bw_weight(villageData)
) |> 
  boot_bw_sample_within_clusters()

xMean <- bootClassic(
  x = boot, params = c("anc1", "anc2", "anc3", "anc4")
)

test_that("xMean is a numeric vector", {
  expect_type(xMean, "double")
})

test_that("xMean length is length of params", {
  expect_equal(length(xMean), 4)
})

test_that("bootClassic errors and messages as expected", {
  expect_error(bootClassic(boot, c("anc")))
  expect_message(bootClassic(boot, c("anc", "anc1")))
  expect_message(bootClassic(boot, c("anc", "anc1", "anc2")))
  expect_message(bootClassic(boot, c("anc", "test", "anc1", "anc2")))
})

Try the bbw package in your browser

Any scripts or data that you put into this service are public.

bbw documentation built on April 12, 2025, 9:14 a.m.