tests/testthat/test-graphs_erdos.R

context("erdos graph generation")
library(graphR)

# test --------------------------------------------------------------------
test_that("Returned matrix is symmetric", {

  # params
  N <- 20
  avk <- 4

  # generate graph with R
  graph <- erdos_matrix(N, avk)

  # expect
  expect_true(isSymmetric(graph))


})


# test --------------------------------------------------------------------
test_that("Returned matrix is square and of correct size", {

  # params
  N <- 20
  avk <- 4

  # generate graph
  graph <- erdos_matrix(N, avk)

  # rows equal to N
  expect_equal(nrow(graph), N)

  # cols equal to N
  expect_equal(ncol(graph), N)

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