tests/testthat/test-dist_generic.R

test_that("dist extracts prior of correct form.", {
  J <- 5
  arm <- new_arm(function(x) x, 1, J)
  prior <- dist(arm,1)
  Sigma <- prior@Sigma
  beta <- prior@beta
  expect_equal(dim(Sigma), rep(J+1,2))
  expect_equal(beta,rep(0,J+1))
})

test_that("Check that setter method works.", { # This test depends on the getter method working.
  J <- 5
  arm <- new_arm(function(x) x, 1, J)
  new_distribution <- new_prior(J)
  new_distribution@beta <- rep(1,J + 1)
  dist(arm,1) <- new_distribution
  expect_equal( dist(arm,1)@beta , rep(1, J + 1) )
})
dfcorbin/MABsim documentation built on April 26, 2020, 8:26 a.m.