This file is indexed.

/usr/lib/R/site-library/igraph/tests/test_sdf.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
44
45
46
47
48
49
50
context("sdf")

test_that("sdf works", {

  library(igraph)

  sdf <- igraph:::sdf(id=1:10, color="black")
  expect_that(as.data.frame(sdf),
              equals(data.frame(id=1:10, color="black")))

  ## access

  expect_that(sdf[1,"id"], equals(1))
  expect_that(sdf[1:4, "id"], equals(1:4))
  expect_that(sdf[, "id"], equals(1:10))

  expect_that(sdf[1, "color"], equals("black"))
  expect_that(sdf[1:4, "color"], equals(rep("black", 4)))
  expect_that(sdf[, "color"], equals(rep("black", 10)))

  ## set

  sdf2 <- sdf
  sdf2[5, "id"] <- 100
  expect_that(as.data.frame(sdf2),
              equals(data.frame(id=c(1:4,100,6:10), color="black")))

  sdf2 <- sdf
  sdf2[, "id"] <- 0
  expect_that(as.data.frame(sdf2),
              equals(data.frame(id=rep(0,10), color="black")))

  sdf2 <- sdf
  sdf2[2:10, "id"] <- 1
  expect_that(as.data.frame(sdf2),
              equals(data.frame(id=rep(1,10), color="black")))

  sdf2 <- sdf
  sdf2[, "color"] <- "white"
  expect_that(as.data.frame(sdf2),
              equals(data.frame(id=1:10, color="white")))

  sdf2 <- sdf
  sdf2[5:6, "color"] <- "white"
  expect_that(as.data.frame(sdf2),
              equals(data.frame(id=1:10, color=c(rep("black", 4),
                                           rep("white", 2),
                                           rep("black", 4)))))

})