-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
540d1db
commit 374914b
Showing
2 changed files
with
78 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# This file is part of the standard setup for testthat. | ||
# It is recommended that you do not modify it. | ||
# | ||
# Where should you do additional test configuration? | ||
# Learn more about the roles of various files in: | ||
# * https://r-pkgs.org/tests.html | ||
# * https://testthat.r-lib.org/reference/test_package.html#special-files | ||
|
||
library(testthat) | ||
library(clustSIGNAL) | ||
|
||
test_check("clustSIGNAL") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# test_that("Checking dimensions of neighbours matrix", { | ||
# data(example) | ||
# cells <- "uniqueID" | ||
# samples <- "sample_id" | ||
# NN <- 30 | ||
# out <- clustSIGNAL::neighbourDetect(spe, samples, NN, cells, | ||
# sort = TRUE) | ||
# | ||
# testthat::expect_equal( | ||
# dim(out$nnCells), | ||
# as.integer(c(ncol(spe), NN + 1)) | ||
# ) | ||
# }) | ||
# | ||
# test_that("Checking neighbours detected for all cells", { | ||
# data(example) | ||
# cells <- "uniqueID" | ||
# samples <- "sample_id" | ||
# NN <- 30 | ||
# out <- clustSIGNAL::neighbourDetect(spe, samples, NN, cells, | ||
# sort = TRUE) | ||
# | ||
# testthat::expect_identical( | ||
# as.character(out$nnCells[, 1]), | ||
# spe[[cells]] | ||
# ) | ||
# }) | ||
|
||
test_that( | ||
"Expecting error when wrong column name given for samples", { | ||
data(example) | ||
samples <- "wrongID" | ||
cells <- "uniqueID" | ||
|
||
testthat::expect_error( | ||
suppressWarnings(clustSIGNAL(spe, samples, cells)) | ||
) | ||
} | ||
) | ||
|
||
test_that( | ||
"Expecting error when wrong column name given for cells", { | ||
data(example) | ||
samples <- "sample_id" | ||
cells <- "wrongID" | ||
|
||
testthat::expect_error( | ||
suppressWarnings(clustSIGNAL(spe, samples, cells)) | ||
) | ||
} | ||
) | ||
|
||
test_that( | ||
"Expecting error when spatial coordinates missing", { | ||
data(example) | ||
samples <- "sample_id" | ||
cells <- "uniqueID" | ||
colData(spe) <- cbind(colData(spe), spatialCoords(spe)) | ||
spatialCoords(spe) <- NULL | ||
|
||
testthat::expect_error( | ||
suppressWarnings(clustSIGNAL(spe, samples, cells)) | ||
) | ||
} | ||
) | ||
|