/usr/lib/R/site-library/ShortRead/unitTests/test_SRFilterResult.R is in r-bioc-shortread 1.36.0-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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | mkScalar <- Biobase::mkScalar
test_SRFilterResult_constructor <- function()
{
checkTrue(validObject(SRFilterResult()))
fr <- SRFilterResult(TRUE)
checkTrue(validObject(fr))
checkIdentical(mkScalar(NA_character_), name(fr))
df <- data.frame(Name=NA_character_, Input=1L, Passing=1L,
Op=NA_character_, stringsAsFactors=FALSE)
checkIdentical(df, stats(fr))
fr <- SRFilterResult(c(TRUE, FALSE))
df <- data.frame(Name=NA_character_, Input=2L, Passing=1L,
Op=NA_character_, stringsAsFactors=FALSE)
checkIdentical(df, stats(fr))
fr <- SRFilterResult(c(TRUE, FALSE),"A")
df <- data.frame(Name="A", Input=2L, Passing=1L, Op=NA_character_,
stringsAsFactors=FALSE)
checkIdentical(df, stats(fr))
}
test_SRFilterResult_logic <- function()
{
a <- SRFilterResult(c(TRUE, FALSE), "A")
b <- SRFilterResult(c(FALSE, TRUE), "B")
checkTrue(all(a|b))
exp <-
structure(list(Name = c("A", "B", "(A | B)"),
Input = c(2L, 2L, 2L), Passing = c(1L, 1L, 2L),
Op = c(NA, NA, "|")),
.Names = c("Name", "Input", "Passing", "Op"),
row.names = c(NA, -3L), class = "data.frame")
checkIdentical(exp, stats(a|b))
checkTrue(all(!b == !(b@.Data)))
exp <-
structure(list(Name = c("B", "!(B)"), Input = c(2L, 2L),
Passing = c(1L, 1L), Op = c(NA, "!")),
.Names = c("Name", "Input", "Passing", "Op"),
row.names = c(NA, -2L), class = "data.frame")
checkIdentical(exp, stats(!b))
}
test_SRFilterResult_SRFilter <- function()
{
fa <- srFilter(function(x) logical(length(x)), "A")
x <- fa(1:10)
checkIdentical(logical(10L), x@.Data)
checkIdentical(mkScalar("A"), name(x))
exp <-
structure(list(Name = "A", Input = 10L, Passing = 0L, Op =
NA_character_),
.Names = c("Name", "Input", "Passing", "Op"),
row.names = c(NA, -1L), class = "data.frame")
checkIdentical(exp, stats(x))
x <- fa(1:10) & fa(1:10)
checkIdentical(logical(10L), x@.Data)
checkIdentical(mkScalar("(A & A)"), name(x))
exp <-
structure(list(Name = c("A", "A", "(A & A)"),
Input = c(10L, 10L, 10L), Passing = c(0L, 0L, 0L),
Op = c(NA, NA, "&")),
.Names = c("Name", "Input", "Passing", "Op"),
row.names = c(NA, -3L), class = "data.frame")
checkIdentical(exp, stats(x))
fb <- srFilter(function(x) !logical(length(x)), "B")
x <- fa(1:10) | fb(1:10)
checkIdentical(!logical(10L), x@.Data)
checkIdentical(mkScalar("(A | B)"), name(x))
exp <-
structure(list(Name = c("A", "B", "(A | B)"),
Input = c(10L, 10L, 10L), Passing = c(0L, 10L, 10L),
Op = c(NA, NA, "|")),
.Names = c("Name", "Input", "Passing", "Op"),
row.names = c(NA, -3L), class = "data.frame")
checkIdentical(exp, stats(x))
}
|