| 1 |
test_that("large dendogram completes in reasonable time", { |
| 2 |
|
| 3 |
skip_on_cran() |
| 4 |
|
| 5 |
# find data file location |
| 6 |
file_location <- c( |
| 7 |
"tests/testthat/data/node_overflow_data.rds", "data/node_overflow_data.rds" |
| 8 |
) |
| 9 |
fl <- file_location[file.exists(file_location)] |
| 10 |
node_overflow_data <- readRDS(fl) |
| 11 |
|
| 12 |
# run hclust |
| 13 |
dhc <- hclust(dist(node_overflow_data), method = "average") |
| 14 |
|
| 15 |
# start ggdendro tests |
| 16 |
elapsed_time <- system.time({ |
| 17 |
dhd <- dendro_data(dhc, type = "rectangle") |
| 18 |
})[[3]] |
| 19 |
|
| 20 |
|
| 21 |
# performance expectation: complete in less than 4 seconds |
| 22 |
expect_lt(elapsed_time, 10) |
| 23 |
|
| 24 |
expect_s3_class(dhd, "dendro") |
| 25 |
p2 <- ggdendrogram(dhd, type = "rectangle") |
| 26 |
|
| 27 |
expect_s3_class(p2, "ggplot") |
| 28 |
}) |