tests/testthat/test_population_size.R

test_that("lt.population_size fails for wrong input", {
  expect_snapshot_error(lt.population_size(1))
})

test_that("lt.population_size produces the right output", {
  sl <- life.table(schleswig_ma[c("a", "Dx")])
  expect_snapshot_value(
    lt.population_size(sl, t = 100),
    style = c("json2")
  )
  od <- life.table(list(
    "corpus mandibulae" = odagsen_cm[c("a", "Dx")],
    "margo orbitalis" = odagsen_mo[c("a", "Dx")]
  ))
  expect_snapshot_value(
    lt.population_size(od, t = 50),
    style = c("json2")
  )
  expect_snapshot_value(
    lt.population_size(x = 111, e0 = 32.2, k = 1.2, t = 100),
    style = c("json2")
  )
})

Try the mortAAR package in your browser

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

mortAAR documentation built on Aug. 28, 2023, 1:06 a.m.