tests/testthat/test-dist-missing.R

test_that("Missing distribution", {
  dist <- dist_missing()

  expect_equal(format(dist), "NA")

  # quantiles
  expect_equal(quantile(dist, c(0.1, 0.9)), list(c(NA_real_, NA_real_)))

  # pdf
  expect_equal(density(dist, 1:2), list(c(NA_real_, NA_real_)))

  # cdf
  expect_equal(cdf(dist, 1:2), list(c(NA_real_, NA_real_)))

  # stats
  expect_equal(mean(dist), NA_real_)
  expect_equal(variance(dist), NA_real_)
})

Try the distributional package in your browser

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

distributional documentation built on Sept. 17, 2024, 9:11 a.m.