tests/testthat/test-convexhull.R

set.seed(45)
N  <- 1000
P  <- 9
X0 <- matrix(runif(N*P), P)

test_that("convhull detection works", {
  X1 <- matrix(rep(0.5, P))
  expect_true(in_convex_hull(X1, X0))
  X1 <- matrix(rep(.99, P))
  expect_false(in_convex_hull(X1, X0))
})

test_that("convhull with multiple treated units works", {
  X1 <- cbind(rep(0.5, P), rep(.99, P))
  expect_equal(in_convex_hull(X1, X0), c(TRUE, FALSE))
})

Try the pensynth package in your browser

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

pensynth documentation built on May 7, 2026, 9:06 a.m.