tests/testthat/test-parameters.R

test_that("parameters.mcmcr", {
  rlang::scoped_options(lifecycle_verbosity = "quiet")
  lifecycle::expect_deprecated(parameters(mcmcr::mcmcr_example))
  expect_identical(parameters(mcmcr::mcmcr_example), c("alpha", "beta", "sigma"))
  expect_identical(parameters(mcmcr::mcmcr_example, scalar = TRUE), c("sigma"))
  expect_identical(parameters(mcmcr::mcmcr_example, scalar = FALSE), c("alpha", "beta"))
  parameters(mcmcr_example) <- c("alpha1", "alpha2", "alpha3")
  expect_identical(parameters(mcmcr_example), c("alpha1", "alpha2", "alpha3"))
})

test_that("parameters.mcmcrs", {
  rlang::scoped_options(lifecycle_verbosity = "quiet")
  mcmcrs <- mcmcrs(mcmcr::mcmcr_example, mcmcr::mcmcr_example)
  lifecycle::expect_deprecated(parameters(mcmcrs))
  expect_identical(parameters(mcmcrs), c("alpha", "beta", "sigma"))
  expect_identical(parameters(mcmcrs, scalar = TRUE), c("sigma"))
  expect_identical(parameters(mcmcrs, scalar = FALSE), c("alpha", "beta"))
  parameters(mcmcrs) <- c("alpha1", "alpha2", "alpha3")
  expect_identical(parameters(mcmcrs), c("alpha1", "alpha2", "alpha3"))
})

Try the mcmcr package in your browser

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

mcmcr documentation built on Sept. 7, 2021, 1:07 a.m.