Skip to content

Commit 80885f3

Browse files
committed
Add tests
1 parent ac90c6d commit 80885f3

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

tests/testthat/test_plotPairs.R

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,22 @@ test_that("plotPairs works with correct arguments", {
111111
corSizeAdd = 2, pointSize = 0.1, pointAlpha = 0.3,
112112
colorByCorrelation = TRUE, corrColorRange = NULL,
113113
addIdentityLine = FALSE), "ggmatrix")
114+
115+
## scattermore
116+
expect_s3_class(plotPairs(se = se, selAssay = "counts", doLog = TRUE,
117+
pseudocount = 1, corMethod = "pearson",
118+
histBreaks = 40, pointsType = "scattermore", corSizeMult = 5,
119+
corSizeAdd = 2, pointSize = 3.5, pointAlpha = 0.3,
120+
colorByCorrelation = TRUE, corrColorRange = NULL,
121+
addIdentityLine = FALSE), "ggmatrix")
122+
123+
## scattermost
124+
expect_s3_class(plotPairs(se = se, selAssay = "counts", doLog = TRUE,
125+
pseudocount = 1, corMethod = "pearson",
126+
histBreaks = 40, pointsType = "scattermost", corSizeMult = 5,
127+
corSizeAdd = 2, pointSize = 3.5, pointAlpha = 0.3,
128+
colorByCorrelation = TRUE, corrColorRange = NULL,
129+
addIdentityLine = FALSE), "ggmatrix")
114130

115131
## Change font size to correlation relation
116132
expect_s3_class(plotPairs(se = se, selAssay = "counts", doLog = TRUE,

tests/testthat/tests-utils.R

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,20 @@ expect_true(.assertVector(LETTERS[1:2], type = "character", validValues = LETTER
9292
test <- "text"
9393
expect_error(.assertVector(x = test, type = "numeric"),
9494
"'test' must be of class 'numeric")
95+
96+
## -------------------------------------------------------------------------- ##
97+
## Checks, .assertPackagesAvailable
98+
## -------------------------------------------------------------------------- ##
99+
test_that(".assertPackagesAvailable works", {
100+
testfunc <- function(...) .assertPackagesAvailable(...)
101+
expect_error(testfunc(1L))
102+
expect_error(testfunc("test", "error"))
103+
expect_error(testfunc("test", c(TRUE, FALSE)))
104+
105+
expect_true(testfunc("base"))
106+
expect_true(testfunc("githubuser/base"))
107+
expect_true(testfunc(c("base", "methods")))
108+
expect_error(testfunc(c("error", "error2")), "BiocManager")
109+
expect_error(testfunc("error1", suggestInstallation = FALSE), "installed.\n$")
110+
rm(testfunc)
111+
})

0 commit comments

Comments
 (0)