test_that("Example 1 matches paper's expected values (Law & Kelton data)", {
  data_ex1 <- c(0.03, 0.06, 0.10, 0.11, 0.13)
  n <- 10
  r <- 5

  u <- data_ex1

  stats <- stat_edf_censored(u, n)

  expect_equal(round(unname(stats["D_rn"]), 3), 0.370)
  expect_equal(round(unname(stats["G_rn"]), 3), 5.167)
  expect_equal(round(unname(stats["T_rn"]), 3), 0.041)
  expect_equal(round(unname(stats["W2_star_rn"]), 3), 0.199)
  expect_equal(round(unname(stats["W2_rn"]), 3), 0.026)
  expect_equal(round(unname(stats["A2_rn"]), 3), 0.301)
  expect_equal(round(unname(stats["U2_rn"]), 3), 0.012)
  expect_equal(round(unname(stats["TA2_r"]), 3), 2.505)
  expect_equal(round(unname(stats["star_TA2_r"]), 3), 3.098)
})

test_that("Example 2 matches paper's expected values (Barr & Davidson data)", {
  data_ex2 <- c(0.1, 0.2, 0.3, 0.4, 0.7, 1.0, 1.4)
  n <- 20
  r <- 7

  rate_known <- 0.1
  u <- pexp(data_ex2, rate = rate_known)

  stats <- stat_edf_censored(u, n)

  expect_equal(round(unname(stats["TA2_r"]), 3), 3.404)
  expect_equal(round(unname(stats["star_TA2_r"]), 3), 3.042)
})
