Closed catterbu closed 9 years ago
This works:
context("Unit test cluster plotting")
tryCatch({
set.seed(1)
data(fluidigm)
fluidigm <- fluidigm[1:25,]
f_clust <- multi_clust(fluidigm, krange = 2:4)
},
finally = {
set.seed(NULL) # Turn off seed
}
)
test_that("wss plots properly", {
expected_hash <- "47d160c26197e5ef76cd8d0416f56774"
file_path <- tempfile(pattern="wss_plot", tmpdir=tempdir(), fileext=".png")
png(file_path, width=480, height=480, antialias="none")
wss_plot(f_clust, optimal=FALSE)
dev.off()
test_hash <- digest::digest(file.info(file_path)[["size"]], algo="md5")
expect_that(expected_hash, equals(test_hash))
})
@nsh87 Assuming nothing goes wrong with travis, this should be ready to merge now.
@nsh87 I am hesistant to write anything after it got rejected before for something that I thought I had already fixed, but this passed the tests on my local. If travis is kind, this should be ready.
The validation functions, the
multi_clust
function, and all cluster plotting functions have tests to ensure that they are not broken in future updates.