tests/testthat/test-TopologyOnly.R

test_that("TopologyOnly() works", {
  topol <- as.phylo(10, 5)
  tree <- topol
  tree[["edge.length"]] <- topol[["edge"]][, 1]
  tree[["node.label"]] <- seq_len(topol$Nnode)
  
  # .phylo
  expect_equal(TopologyOnly(tree), topol)
  expect_equal(TopologyOnly(Postorder(tree)), topol)
  
  # .list
  expect_equal(TopologyOnly(list(tree, tree)), list(topol, topol))
  
  # .multiPhylo
  expect_equal(TopologyOnly(c(tree, tree)), c(topol, topol))
  
  # .Splits
  expect_equal(TopologyOnly(as.Splits(tree)), as.Splits(topol))
  
  # .NULL
  expect_null(TopologyOnly(NULL))
})

Try the TreeTools package in your browser

Any scripts or data that you put into this service are public.

TreeTools documentation built on Sept. 11, 2024, 8:27 p.m.