|
a |
|
b/tests/testthat/test-getCluster.R |
|
|
1 |
context("getCluster") |
|
|
2 |
|
|
|
3 |
test_that("getCluster faild on invalid input", { |
|
|
4 |
# string |
|
|
5 |
expect_error(getCluster("abc")) |
|
|
6 |
|
|
|
7 |
# integer |
|
|
8 |
expect_error(getCluster(1)) |
|
|
9 |
|
|
|
10 |
# matrix |
|
|
11 |
expect_error(getCluster(matrix(1:9, ncol = 3))) |
|
|
12 |
}) |
|
|
13 |
|
|
|
14 |
demo <- suppressWarnings(get_demo_cluster()) |
|
|
15 |
|
|
|
16 |
|
|
|
17 |
test_that("getCluster works and return a valid output", { |
|
|
18 |
# for(i in c("pca", "spca", "pls", "spls", "block.pls", "block.spls")){ |
|
|
19 |
# expect_is(getCluster(demo[[i]]), "cluster.df") |
|
|
20 |
# #expect_is(getCluster(demo$pca), "cluster.df") |
|
|
21 |
#} |
|
|
22 |
expect_is(getCluster(demo$pca), "cluster.df") |
|
|
23 |
expect_is(getCluster(demo$spca), "cluster.df") |
|
|
24 |
expect_is(getCluster(demo$pls), "cluster.df") |
|
|
25 |
expect_is(getCluster(demo$spls), "cluster.df") |
|
|
26 |
expect_is(getCluster(demo$block.pls), "cluster.df") |
|
|
27 |
expect_is(getCluster(demo$block.spls), "cluster.df") |
|
|
28 |
expect_is(getCluster(demo$UpDown), "cluster.df") |
|
|
29 |
|
|
|
30 |
}) |