tests/testthat/test-as_graph6.R

test_that("as_graph6() works for simple matrices", {
  m <- matrix(c(0,1,1,0), 2, 2) # complete size 2
  expect_silent(as_graph6(m))
})

test_that("annoying #9 'corrupted size vs prev_size' crash", {
  m <- structure(
    c(0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1,  
      1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1,  
      1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1,  
      0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1,  
      1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1,  
      1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1,  
      0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1,  0), 
    .Dim = c(12L, 12L)
  )
  expect_silent(
    as_graph6(m)
  )
})
mbojan/rgraph6 documentation built on Feb. 4, 2024, 3:40 p.m.