tests/testthat/test_randomization.R

context("")
test_that("The randomization is", {
  suppressWarnings(RNGversion("3.5.0"))
  set.seed(200)
  check <- sample(rep(0:1, c(60, 40)))
  set.seed(200)
  expect_equal(randomization(100, 100, c(3, 2)), check)
  set.seed(40555)
  expect_equal(sum(randomization(12, 10, c(3, 2)) == 1), 5)
  expect_equal(sum(randomization(200, 21, c(3, 4))), 113)
  expect_equal(sum(randomization(200, c(10, 20), c(1, 4)) == 0), 40)
  expect_error(randomization(20, 40, c(1, 4)))
  expect_error(randomization(100, 20, c(2, 1)))
  expect_error(randomization(200, 4, c(1.5, 2.5)))
  expect_error(randomization(20, 1.1, c(1, 4)))
})
thevaachandereng/bayesCT documentation built on July 25, 2020, 9:20 p.m.