tests/testthat/test_seeding.R

context("Check if seeding based on object is working")

test_that("seeding works", {
  # '<<-' is required here because of the testing environment.
  x <<- rnorm(10)
  y <<- x

  expect_error(seedBoundedToObject(x))
  expect_error(seedBoundedToObject("x", rm_attributes = "TRUE"))
  expect_equal(seedBoundedToObject("x"), seedBoundedToObject("y"))

  z <<- x
  attr(z, "a") = 1
  expect_equal(seedBoundedToObject("x"), seedBoundedToObject("z", rm_attributes = TRUE))
})
difuture-lmu/dsROCGLM documentation built on March 24, 2024, 1:07 p.m.