tests/testthat/test-tar_jags_example_data.R

# targets::tar_test() runs the test code inside a temporary directory
# to avoid accidentally writing to the user's file space.
targets::tar_test("tar_jags_example_data() returns correctly formatted data", {
  out <- tar_jags_example_data(n = 50L)
  expect_equal(out$n, 50L)
  expect_equal(length(out$x), 50L)
  expect_equal(length(out$y), 50L)
  expect_true(is.numeric(out$x))
  expect_true(is.numeric(out$y))
})

Try the jagstargets package in your browser

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

jagstargets documentation built on Sept. 11, 2024, 6:21 p.m.