tests/testthat/test-vcg.R

test_that("VCG functions", {

  n <- 20
  A <- matrix(rnorm(n * 3), nrow = n)
  B <- matrix(rnorm(n * 6), nrow = n * 2)
  result <- vcg_kdtree_nearest(
    target = B, query = A,
     k = 1
  )
  nearest_index <- apply(A, 1, function(pt) {
    which.min(colSums((t(B) - pt) ^ 2))
  })

  expect_true(all(result$index == nearest_index))

})

Try the ravetools package in your browser

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

ravetools documentation built on May 31, 2026, 9:06 a.m.