test_that("identification bounds contain the fitted synthetic estimate", {
  skip_if_not_installed("lpSolve")
  x <- inter_example()
  fit <- fit_inter_sae(
    unemployed ~ sex + age + residence + area,
    inter_design(x$survey, "weight", "area"),
    census_margins(x$margins),
    family = "binomial"
  )
  bounds <- identification_bounds(fit, list(area = "A1"), gamma = 1.5)
  expect_s3_class(bounds, "inter_bounds")
  expect_lte(bounds$lower, bounds$estimate + 1e-8)
  expect_gte(bounds$upper, bounds$estimate - 1e-8)
})

test_that("a short multiplier bootstrap returns replicates", {
  x <- inter_example()
  fit <- fit_inter_sae(
    unemployed ~ sex + age + residence + area,
    inter_design(x$survey, "weight", "area", "strata", "psu"),
    census_margins(x$margins),
    family = "binomial"
  )
  boot <- inter_bootstrap(fit, R = 3, seed = 7)
  expect_s3_class(boot, "inter_bootstrap")
  expect_equal(ncol(boot$replicates), 3L)
})
