Skip to content

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
KlausVigo committed Oct 7, 2017
1 parent 5e71cd0 commit fc2626c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
20 changes: 12 additions & 8 deletions tests/testthat/test_phyDat.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,20 @@ phy_vec_dna <- phy_matrix[,1]
phy_vec_user <- sample(c("0","1"), 26, replace=TRUE)
names(phy_vec_user) <- letters
phy_dnabin <- as.DNAbin(Laurasiatherian)
phy_aabin <- as.AAbin(chloroplast)
phy_align <- phyDat2alignment(Laurasiatherian)

test_that("conversion work as expected", {
## skip_on_cran()
expect_is(phy_matrix, "matrix")
expect_is(phy_df, "data.frame")
expect_is(phy_dnabin, "DNAbin")
expect_is(phy_aabin, "AAbin")
expect_is(phy_align, "alignment")
expect_is(as.phyDat(phy_matrix), "phyDat")
expect_is(as.phyDat(phy_df), "phyDat")
expect_is(as.phyDat(phy_dnabin), "phyDat")
expect_equal(as.phyDat(phy_aabin), chloroplast)
expect_is(phyDat(phy_vec_dna), "phyDat")
expect_is(phyDat(phy_vec_user, type="USER", levels = c("0","1")), "phyDat")
expect_is(as.phyDat(phy_dnabin), "phyDat")
Expand All @@ -33,14 +36,15 @@ test_that("conversion work as expected", {
})


#test_that("conversion with Biostrings work as expected", {
# skip_on_cran()
# library(Biostrings)
# expect_is(MA_AA <- as.MultipleAlignment(chloroplast), "AAMultipleAlignment")
# expect_equal(as.phyDat(MA_AA), chloroplast)
# expect_is(MA_DNA <- as.MultipleAlignment(Laurasiatherian), "DNAMultipleAlignment")
# expect_equal(as.phyDat(MA_DNA), Laurasiatherian)
#})
test_that("conversion with Biostrings work as expected", {
skip_on_cran()
if(require(Biostrings)){
expect_is(MA_AA <- as.MultipleAlignment(chloroplast), "AAMultipleAlignment")
expect_equal(as.phyDat(MA_AA), chloroplast)
expect_is(MA_DNA <- as.MultipleAlignment(Laurasiatherian), "DNAMultipleAlignment")
expect_equal(as.phyDat(MA_DNA), Laurasiatherian)
}
})


test_that("subsetting and combining work as expected", {
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test_treeManipulation.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ node_108 <- mrca.phylo(tree, node=desc_108)
test_that("ancestor, mrca, descendants", {
## ancestor, mrca, descendants
expect_equal(mrca.phylo(tree, node=desc_108), 108L)
expect_equal(mrca(tree), mrca.phylo(tree))
kids_108 <- Descendants(tree, 108, "children")
expect_equal(length(Descendants(tree, 101L, "all")), 197L)
expect_equal(lengths(Descendants(tree2, 101L:199, "all")), 2 * lengths(prop.part(tree2)) - 2L)
Expand Down

0 comments on commit fc2626c

Please sign in to comment.