Nothing
# Tests for plot_ism()
test_that("plot_ism validates input", {
expect_error(plot_ism(c(1, 2, 3)), "must be a matrix")
expect_error(plot_ism(matrix(1:6, nrow = 2)), "must be square")
})
test_that("plot_ism returns list invisibly", {
adj <- matrix(c(0, 1, 0, 0), nrow = 2, byrow = TRUE)
reach <- compute_reachability(adj)
# Suppress graphical output during testing
pdf(NULL)
result <- plot_ism(reach)
dev.off()
# plot_ism now returns a list invisibly
expect_true(is.list(result))
expect_true("levels" %in% names(result))
expect_true("edges" %in% names(result))
})
test_that("plot_ism handles matrix with names", {
adj <- matrix(c(0, 1, 0, 0), nrow = 2, byrow = TRUE)
rownames(adj) <- colnames(adj) <- c("A", "B")
reach <- compute_reachability(adj)
# Should not error
pdf(NULL)
expect_no_error(plot_ism(reach))
dev.off()
})
test_that("plot_ism with show_transitive option", {
adj <- matrix(c(0, 1, 1, 0, 0, 1, 0, 0, 0), nrow = 3, byrow = TRUE)
reach <- compute_reachability(adj)
pdf(NULL)
# Default: transitive edges removed
result1 <- plot_ism(reach, show_transitive = FALSE)
# Show all edges
result2 <- plot_ism(reach, show_transitive = TRUE)
dev.off()
# With transitive removal, should have fewer edges
expect_true(nrow(result1$edges) <= nrow(result2$edges))
})
test_that("plot_ism with igraph backend", {
skip_if_not_installed("igraph")
adj <- matrix(c(0, 1, 0, 0), nrow = 2, byrow = TRUE)
rownames(adj) <- colnames(adj) <- c("A", "B")
reach <- compute_reachability(adj)
pdf(NULL)
expect_no_error(plot_ism(reach, use_igraph = TRUE))
dev.off()
})
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.