Skip to content

Commit

Permalink
added test for which_node and which_leaf
Browse files Browse the repository at this point in the history
  • Loading branch information
alecbuetow committed Nov 12, 2024
1 parent d1c22ed commit 5c83fa5
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/testthat/test-noded_with_condition.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,26 @@ test_that("noded_with_condition works", {
)

})


test_that("which_leaf works", {
# if non-dendrogram object passed in
expect_error(
which_leaf(1:4)
)
})


test_that("which_node works", {
dend <- iris[1:10, -5] %>%
dist() %>%
hclust() %>%
as.dendrogram() %>%
set("labels", 1:10)

expect_equal(
which_node(dend, c(1, 2)),
2
)

})

0 comments on commit 5c83fa5

Please sign in to comment.