File: test-vs-es-quirks.R

package info (click to toggle)
r-cran-igraph 1.0.1-1%2Bdeb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 18,232 kB
  • sloc: ansic: 173,538; cpp: 19,365; fortran: 4,550; yacc: 1,164; tcl: 931; lex: 484; makefile: 149; sh: 9
file content (32 lines) | stat: -rw-r--r-- 688 bytes parent folder | download | duplicates (5)
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

context("Vertex and edge sequence quirks")

test_that("graph is not updated if not in LHS", {

  g <- make_(ring(10),
             with_vertex_(name = LETTERS[1:10]),
             with_edge_(weight = 1:10))

  vs <- V(g)[1:5]
  vs$name <- letters[1:5]
  expect_equal(V(g)$name, LETTERS[1:10])

  es <- E(g)
  es$weight <- 0
  expect_equal(E(g)$weight, 1:10)

})

test_that("graph is updated if in LHS", {

  g <- make_(ring(10),
             with_vertex_(name = LETTERS[1:10]),
             with_edge_(weight = 1:10))

  V(g)[1:5]$name <- letters[1:5]
  expect_equal(V(g)$name, c(letters[1:5], LETTERS[6:10]))

  E(g)[1:5]$weight <- 0
  expect_equal(E(g)$weight, c(rep(0, 5), 6:10))

})