tests/testthat/test-ptsource.R

test_that("ptsource", {

  # setup -------------------------------------------------------------------

  n_patch <- round(runif(1, min = 5, max = 50))
  p_branch <- 0
  n_source <- round(runif(1, min = 1, max = n_patch))

  x <- brnet(n_patch = n_patch,
             p_branch = p_branch)

  y <- ptsource(x,
                n_source = n_source,
                p = 1,
                q = 0)

  y <- y$df_patch

  # test --------------------------------------------------------------------

  expect_equal(max(dplyr::pull(y, impact)), n_source)
})
aterui/mcbrnet documentation built on Nov. 14, 2024, 3:14 a.m.