tests/testthat/test-complex-witness.R

test_that("Class `WitnessComplex` works", {
  withr::with_seed(1234, {
    l <- list(
      tibble::tibble(
        nearest_landmark = sample.int(10),
        distance = sort(stats::rexp(10))
      ),
      tibble::tibble(
        nearest_landmark = sample.int(10),
        distance = sort(stats::rexp(10))
      )
    )
  })
  wc <- WitnessComplex$new(nearest_landmark_table = l)
  st <- wc$create_simplex_tree()
  expect_equal(st$num_simplices(), 1023)
})

test_that("Class `StrongWitnessComplex` works", {
  withr::with_seed(1234, {
    l <- list(
      tibble::tibble(
        nearest_landmark = sample.int(10),
        distance = sort(stats::rexp(10))
      ),
      tibble::tibble(
        nearest_landmark = sample.int(10),
        distance = sort(stats::rexp(10))
      )
    )
  })
  swc <- StrongWitnessComplex$new(nearest_landmark_table = l)
  st <- swc$create_simplex_tree()
  expect_equal(st$num_simplices(), 1023)
})

Try the rgudhi package in your browser

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

rgudhi documentation built on March 31, 2023, 11:38 p.m.