This file is indexed.

/usr/lib/R/site-library/igraph/tests/test_iterators.R is in r-cran-igraph 0.7.1-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 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
context("iterators")

test_that("iterators work", {

  library(igraph)

  ## Create a small ring graph, assign attributes
  ring <- graph.formula( A-B-C-D-E-F-G-A )
  E(ring)$weight <- seq_len(ecount(ring))

  ## Selection based on attributes
  expect_that(sort(E(ring)[ weight < 4 ]$weight), equals(1:3))
  expect_that(V(ring)[ c("A", "C") ]$name, equals(c("A", "C")))

  ## TODO: %--%, %->%, other special functions

})

test_that("complex attributes work", {
  library(igraph)

  g <- graph.ring(10)
  foo <- lapply(1:vcount(g), seq, from=1)
  V(g)$foo <- foo

  V(g)$foo[[5]][1:3] <- 0
  expect_that(V(g)[(1:10)[-5]]$foo, equals(foo[-5]))
  expect_that(V(g)[[5]]$foo, equals(c(0,0,0,4,5)))
  expect_that(V(g)[5]$foo, equals(list(c(0,0,0,4,5))))

  V(g)$foo <- foo
  V(g)[[5]]$foo[1:3] <- 0
  expect_that(V(g)[(1:10)[-5]]$foo, equals(foo[-5]))
  expect_that(V(g)[[5]]$foo, equals(c(0,0,0,4,5)))
  expect_that(V(g)[5]$foo, equals(list(c(0,0,0,4,5))))

  V(g)$foo <- foo
  V(g)[5]$foo[[1]][1:3] <- 0
  expect_that(V(g)[(1:10)[-5]]$foo, equals(foo[-5]))
  expect_that(V(g)[[5]]$foo, equals(c(0,0,0,4,5)))
  expect_that(V(g)[5]$foo, equals(list(c(0,0,0,4,5))))

})