tests/testthat/test-vld.R

test_that("vld_mcmcarray", {
  expect_true(vld_mcmcarray(as.mcmcarray(1)))
  expect_false(vld_mcmcarray(structure(1, class = "mcmcarray")))
  expect_false(vld_mcmcarray(structure(TRUE, .Dim = 1L, class = "mcmcarray")))

  x <- array(TRUE)
  class(x) <- "mcmcarray"
  expect_error(chk_mcmcarray(x), "^`x` must be numeric[.]$",
    class = "chk_error"
  )

  expect_false(vld_mcmcarray(1))
  expect_false(vld_mcmcarray(array(1)))
  expect_true(vld_mcmcarray(as.mcmcarray(1)))
})

test_that("vld_mcmcr", {
  expect_false(vld_mcmcr(list(x = 1)))
  expect_true(vld_mcmcr(as.mcmcr(list(x = 1))))
})

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.