tests/testthat/test-dyad_census_attr.R

test_that("dyad census attr works", {
    library(igraph)
    gundir <- make_full_graph(3, directed = FALSE)
    gnoatt <- make_full_graph(3, directed = TRUE)
    gchatt <- make_full_graph(3, directed = TRUE)
    vertex_attr(gchatt, "test") <- c("a", "b", "c")
    gattr <- make_full_graph(3, directed = TRUE)
    vertex_attr(gattr, "test") <- c(1, 2, 3)
    expect_error(dyad_census_attr(gundir))
    expect_error(dyad_census_attr(gnoatt))
    expect_error(dyad_census_attr(gchatt, "test"))
    expect_equal(dyad_census_attr(gattr, "test")$sym, c(0, 1, 1, 0, 1, 0))
})
schochastics/netUtils documentation built on Oct. 17, 2024, 10:45 a.m.