tests/testthat/test_rconstant.r

test_that("one value", {
  out <- rconstant(n=1, 10)
  expect_equal(out, 10)

  out <- rconstant(n=1, "BLA")
  expect_equal(out, "BLA")
})

test_that("multiple values", {
  out <- rconstant(n=10, 10)
  expect_equal(out, rep(10, 10))

  out <- rconstant(n=10, "BLA")
  expect_equal(out, rep("BLA", 10))
})

Try the simDAG package in your browser

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

simDAG documentation built on April 3, 2025, 10:35 p.m.