Debian Codegraph @

tests/testthat/test-dist_long.R

raw
1 # library(testthat)
2 # library(dendextend)
3
4
5 context("dist_long")
6
7
8 test_that("dist_long works", {
9
10 long_distance_matrix =
11 iris[2:6, -5] %>%
12 dist() %>%
13 dist_long()
14
15 expect_identical(
16 round(long_distance_matrix[1,3], 3),
17 0.3
18 )
19
20 })
21
22
23 test_that("labels<-.dist works", {
24
25 sample_matrix <- matrix(1:9, nrow = 3)
26 dist_object <- dist(sample_matrix)
27 label_vec <- c("A", "B", "C")
28 labels(dist_object) <- label_vec
29
30 expect_identical(
31 attr(dist_object, "Labels"),
32 label_vec
33 )
34
35 })