tests/testthat/test-as-nlists.R

test_that("as_nlists.mcmc", {
  nlists <- nlist::nlists(
    nlist::nlist(x = 1, y = matrix(1:4, 2)),
    nlist::nlist(x = 3, y = matrix(4:1, 2))
  )
  expect_equal(nlist::as_nlists(nlist::as_mcmc(nlists)), nlists)
})

test_that("as_nlists.mcmc.list", {
  nlists <- nlist::nlists(
    nlist::nlist(x = 1, y = matrix(1:4, 2)),
    nlist::nlist(x = 3, y = matrix(4:1, 2))
  )
  expect_equal(as_nlists(nlist::as_mcmc_list(nlists)), nlists)
})

test_that("as_nlists.mcmcr", {
  nlists <- nlist::nlists(
    nlist::nlist(x = 1, y = matrix(1:4, 2)),
    nlist::nlist(x = 3, y = matrix(4:1, 2))
  )
  expect_equal(nlist::as_nlists(as.mcmcr(nlists)), nlists)
})

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.