tests/testthat/test-check_normal_prior.R

test_that("check_normal_prior works", {
  # This should produce no error messages
  expect_equal(check_normal_prior(c(0, 2), "intercept"), expected=TRUE)

  # Error: non-numeric data
  expect_error(check_normal_prior(c("0", "2"), "intercept"))

  # Error: wrong number of values
  expect_error(check_normal_prior(c(0, 2, 3), "intercept"))
  expect_error(check_normal_prior(c(0), "intercept"))

  # Error: non-positive variance
  expect_error(check_normal_prior(c(0, -2), "intercept"))
  expect_error(check_normal_prior(c(0, 0), "intercept"))
})

Try the bistablehistory package in your browser

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

bistablehistory documentation built on Sept. 13, 2023, 5:07 p.m.