Skip to content

Commit

Permalink
change tests from testthat to tinytest
Browse files Browse the repository at this point in the history
  • Loading branch information
KlausVigo committed Dec 4, 2019
1 parent 777618e commit c7d1998
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 57 deletions.
27 changes: 27 additions & 0 deletions inst/tinytest/test_phyloregion.R
@@ -0,0 +1,27 @@
## generate data

library(phyloregion)
library(betapart)
library(ape)

tree <- read.tree(text ="((t1:1,t2:1)N2:1,(t3:1,t4:1)N3:1)N1;")
com <- matrix(c(1,0,1,1,0,0,
1,0,0,1,1,0,
1,1,1,1,1,1,
0,0,1,1,0,1), 6, 4,
dimnames=list(paste0("g",1:6), tree$tip.label))

pd_bioregion <- PD.sparse(com, tree)

pbc_phyloregion <- phylobeta_core(com, tree)
pbc_betapart <- phylo.betapart.core(com, tree)

# check if betapart and phyloregion are equal
expect_equal(phylo.beta.multi(pbc_phyloregion),
phylo.beta.multi(pbc_betapart))
expect_equivalent(phylo.beta.pair(pbc_phyloregion),
phylo.beta.pair(pbc_betapart))

# test pd compare with picante
# test
pb_phyloregion <- phylobeta(com, tree)
4 changes: 0 additions & 4 deletions tests/testthat.R

This file was deleted.

53 changes: 0 additions & 53 deletions tests/testthat/test_phylobeta.R

This file was deleted.

3 changes: 3 additions & 0 deletions tests/tinytest.R
@@ -0,0 +1,3 @@
if (require("tinytest", quietly=TRUE)){
test_package("phyloregion")
}

0 comments on commit c7d1998

Please sign in to comment.