-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add unit test for function CreatePathwayCollection per issue #70
- Loading branch information
Lizhong Liu
committed
Mar 25, 2019
1 parent
c12ef8d
commit f3169e1
Showing
3 changed files
with
50 additions
and
1 deletion.
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
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,4 @@ | ||
library(testthat) | ||
library(pathwayPCA) | ||
|
||
test_check("pathwayPCA") |
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,44 @@ | ||
context("CreatePathwayCollection") | ||
|
||
test_that("CreatePathwayCollection gives correct errors", { | ||
expect_error(CreatePathwayCollection( | ||
sets_ls = "pathway", | ||
TERMS = "five", | ||
setType = "pathway", | ||
setsize = 1 | ||
), | ||
"The sets_ls object must be a list of set membership vectors.") | ||
|
||
expect_error(CreatePathwayCollection( | ||
sets_ls = list(one = 1, five = 5), | ||
TERMS = list(five = "five"), | ||
setType = "pathway", | ||
setsize = 1 | ||
), | ||
"The TERMS object must be an atomic vector.") | ||
|
||
expect_error(CreatePathwayCollection( | ||
sets_ls = list(one = 1, five = 5), | ||
TERMS = "five", | ||
setType = "gene", | ||
setsize = 1 | ||
), | ||
"The TERMS vector must have the same length as the sets list.") | ||
}) | ||
|
||
test_that("CreatePathwayCollection gives correct warnings", { | ||
expect_warning(CreatePathwayCollection( | ||
sets_ls = list(one = 1, | ||
two = 1:2, | ||
three = 1:3, | ||
four = 1:4, | ||
five = 1:5), | ||
TERMS = c("one", "two", "three", "four", "five"), | ||
setType = "gene", | ||
setsize = 1 | ||
), | ||
"The names 'setsize' and 'n_tested' are reserved names of a pathwayCollection object. | ||
Values stored with these names may be overwritten during pathwayPCA function execution. | ||
Use with extreme caution.") | ||
|
||
}) |