tests/testthat/test_BHI.R

context("BHI")

test_that("BHI works for (1, 2, 3)", {
  expect_equal(BHI(1:3), sqrt(3)*2/9, tolerance = 1e-8)
})

test_that("BHI works for (1, 2, 3, 4)", {
  expect_equal(BHI(1:4), 2*5/24, tolerance = 1e-8)
})

test_that("BHI works for rnorm(50)", {
  set.seed(1)
  X <- rnorm(50)
  expect_equal(BHI(X), sqrt(50)*0.0363346, tolerance = 1e-6)
})

Try the symmetry package in your browser

Any scripts or data that you put into this service are public.

symmetry documentation built on March 31, 2023, 7:30 p.m.