File: test-asDF.R

package info (click to toggle)
r-cran-intergraph 2.0-4-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 392 kB
  • sloc: sh: 13; makefile: 2
file content (46 lines) | stat: -rw-r--r-- 1,616 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# From 'network' objects --------------------------------------------------

test_that("asDF(exNetwork) returns data frames with proper no of rows", {
  expect_silent(
    l <- asDF(exNetwork)
  )
  # Created edgelist has appropriate number of edges
  expect_equal(nrow(l$edges), network::network.edgecount(exNetwork))
  # Created vertex data frame has correct number of vertices
  expect_equal(nrow(l$vertexes), network::network.size(exNetwork))
})

test_that("asDF(exNetwork2) returns data frames with proper no of rows", {
  expect_silent(
    l <- asDF(exNetwork2)
  )
  # Created edgelist has appropriate number of edges
  expect_equal( nrow(l$edges), network::network.edgecount(exNetwork))
  # Created vertex data frame has correct number of vertices
  expect_equal( nrow(l$vertexes), network::network.size(exNetwork))
})



# From 'igraph' objects ---------------------------------------------------

test_that("asDF(exIgraph) returns data frames with proper no of rows", {
  expect_silent(
    l <- asDF(exIgraph)
  )
  # Created edgelist has appropriate number of edges
  expect_equal(nrow(l$edges), igraph::ecount(exIgraph))
  # Created vertex data frame has correct number of vertices
  expect_equal(nrow(l$vertexes), igraph::vcount(exIgraph))
})

test_that("asDF(exIgraph2) returns data frames with proper no of rows", {
  expect_silent(
    l <- asDF(exIgraph2)
  )
  # Created edgelist has appropriate number of edges
  expect_equal( nrow(l$edges), igraph::ecount(exIgraph2))
  # Created vertex data frame has correct number of vertices
  expect_equal( nrow(l$vertexes), igraph::vcount(exIgraph2))
})