|
a |
|
b/tests/testthat/test-class.R |
|
|
1 |
library(SummarizedExperiment) |
|
|
2 |
library(biotmleData) |
|
|
3 |
data(illuminaData) |
|
|
4 |
|
|
|
5 |
## SETUP TESTS ################################################################ |
|
|
6 |
example_biotmle_class <- function(se) { |
|
|
7 |
call <- match.call(expand.dots = TRUE) |
|
|
8 |
biotmle <- .biotmle( |
|
|
9 |
SummarizedExperiment( |
|
|
10 |
assays = assay(se), |
|
|
11 |
rowData = rowData(se), |
|
|
12 |
colData = colData(se) |
|
|
13 |
), |
|
|
14 |
call = call, |
|
|
15 |
tmleOut = as.data.frame(matrix(NA, 10, 10)), |
|
|
16 |
topTable = as.data.frame(matrix(NA, 10, 10)) |
|
|
17 |
) |
|
|
18 |
return(biotmle) |
|
|
19 |
} |
|
|
20 |
biotmle <- example_biotmle_class(se = illuminaData) |
|
|
21 |
|
|
|
22 |
## BEGIN TESTS ################################################################ |
|
|
23 |
test_that("biotmle object is of class type S4", { |
|
|
24 |
expect_equivalent(typeof(biotmle), "S4") |
|
|
25 |
}) |
|
|
26 |
|
|
|
27 |
test_that("biotmle object is of appropriate class", { |
|
|
28 |
expect_equivalent(class(biotmle), "bioTMLE") |
|
|
29 |
}) |
|
|
30 |
|
|
|
31 |
test_that("biotmle is a subclass of SummarizedExperiment", { |
|
|
32 |
expect_is(biotmle, "SummarizedExperiment") |
|
|
33 |
}) |