tests/testthat/test-mentor.r

context("Mentor matching")

# ------------------------------------------------------------------------------
test_that("Mentor matching", {
  set.seed(1)

  g <- igraph::make_graph(~1--2,1--3,1--4,4--5,6)
  g <- igraph::as_adj(g)

  ans <- mentor_matching(g, 2)
  expect_equal(sort(unique(ans$match)), as.character(c(1,4)))
})


# ------------------------------------------------------------------------------
test_that("Plot mentor", {
  set.seed(1)

  g <- igraph::make_graph(~1--2,1--3,1--4,4--5,6)
  g <- igraph::as_adj(g)
  ans <- mentor_matching(g, 2)

  expect_silent(plot(ans))
})
USCCANA/diffusiontest documentation built on Sept. 4, 2023, 11:38 p.m.