tests/testthat/test_log_ddirichlet.R

context("Copied ddirichlet function")

test_that("log_ddirichlet", {
  p <- c(0.81, 0.049, 0.141)
  alpha <- c(73, 4, 8)
  x.cpp <- log_ddirichlet_(p, alpha)
  x.gtools <- gtools::ddirichlet(p, alpha)
  expect_equal(exp(x.cpp), x.gtools)
})
scristia/CNPBayes documentation built on Aug. 9, 2020, 7:31 p.m.