|
a |
|
b/tests/testthat/test-getSilhouette.R |
|
|
1 |
context("getSilhouette") |
|
|
2 |
|
|
|
3 |
demo <- suppressWarnings(get_demo_cluster()) |
|
|
4 |
|
|
|
5 |
test_that("getSilhouette failed on invalid input", { |
|
|
6 |
expect_error(getSilhouette("a"), "no applicable method for") |
|
|
7 |
expect_error(getSilhouette(1),"no applicable method for") |
|
|
8 |
expect_error(getSilhouette(c(1,2)), "no applicable method for") |
|
|
9 |
expect_error(getSilhouette(NA), "no applicable method for") |
|
|
10 |
expect_error(getSilhouette(NULL), "no applicable method for") |
|
|
11 |
}) |
|
|
12 |
|
|
|
13 |
test_that("getSilhouette works", { |
|
|
14 |
expect_is(getSilhouette(demo$pca), "numeric") |
|
|
15 |
expect_is(getSilhouette(demo$spca), "numeric") |
|
|
16 |
|
|
|
17 |
expect_is(getSilhouette(demo$pls), "numeric") |
|
|
18 |
expect_is(getSilhouette(demo$spls), "numeric") |
|
|
19 |
|
|
|
20 |
expect_is(getSilhouette(demo$block.pls), "numeric") |
|
|
21 |
expect_is(getSilhouette(demo$block.spls), "numeric") |
|
|
22 |
}) |