tests/testthat/test-graphs_misc.R

context("graphing utility functions")
library(graphR)

# test --------------------------------------------------------------------
test_that("list2matrix and matrix2list functions works correctly", {

  # params
  N <- 20
  avk <- 4


  # generate graphs
  set.seed(1)
  graph_matrix <- erdos_matrix(N, avk)
  set.seed(1)
  graph_list <- erdos_list(N, avk)

  tmp_list <- matrix2list(graph_matrix)

  tmp_matrix <- list2matrix(graph_list)

  # expect
  expect_equal(graph_matrix, tmp_matrix)
  expect_equal(graph_list, tmp_list)


})
tjtnew/graphr documentation built on May 19, 2019, 9:38 p.m.