tests/testthat/test_bayesRule.R

skip_on_cran()
context("Bayes rule")
library('fracdet', quietly = TRUE)

test_that("bayes rule works as expected", {
  data = readRDS("../testdata/bayesRule.RDS")
  # tolerance has to be quite high due to the difficulties in simulating
  # the highest Hs
  result = apply(data,MARGIN = 1, function(x){
    bayesRule(x[["d"]], as.list(x[2:7]))
  })
  expect_equal(result, data$output, tolerance = 1e-5)
})
citiususc/fracdet documentation built on May 13, 2019, 7:30 p.m.