1
2context("dyad_census")
3
4test_that("dyad_census works", {
5
6  library(igraph)
7
8  g1 <- make_ring(10)
9  expect_that(dc1 <- dyad_census(g1), gives_warning("undirected"))
10  expect_that(dc1, equals(list(mut=10, asym=0, null=35)))
11
12  g2 <- make_ring(10, directed=TRUE, mutual=TRUE)
13  dc2 <- dyad_census(g2)
14  expect_that(dc2, equals(list(mut=10, asym=0, null=35)))
15
16  g3 <- make_ring(10, directed=TRUE, mutual=FALSE)
17  dc3 <- dyad_census(g3)
18  expect_that(dc3, equals(list(mut=0, asym=10, null=35)))
19
20  g4 <- make_empty_graph(2000000)
21  expect_that(dc4 <- dyad_census(g4), gives_warning("Integer overflow"))
22  expect_that(dc4, equals(list(mut=0, asym=0, null=0)))
23
24})
25