# Test readInput.R and makeTreeset.R
context("readinput.R")
context("makeTreeset.R")
# ==== BEGIN SETUP AND PREPARE =================================================
treeset = makeTreeset()
# ==== END SETUP AND PREPARE ===================================================
test_that("makeTreeset() makes a treeset and initializes all values to 0", {
for(i in ls(treeset)) {
expect_equal(treeset[[i]], 0)
}
})
test_that("readInput() accepts correct fileTypes", {
expect_error(readInput("duck", "duck"), "Invalid inputType: beast | mrbayes | paml | r8 | raxml | nhx | phylip | epa")
})
test_that("beast readInput works", {
filepath = system.file("extdata", "beast_mcc.tree", package="phylogetree")
expect_equal(readInput(filepath, "beast")[["beast"]]@file, filepath)
})
test_that("mrbayes readInput works", {
filepath = system.file("extdata", "mrbayes.tre", package="phylogetree")
expect_equal(readInput(filepath, "mrbayes")[["mrbayes"]]@file, filepath)
})
test_that("paml readInput works", {
filepath = system.file("extdata", "paml", package="phylogetree")
expect_equal(readInput(filepath, "paml")[["paml"]]@file, filepath)
})
test_that("r8s readInput works", {
filepath = system.file("extdata", "r8s.output", package="phylogetree")
multiPhylo = readInput(filepath, "r8s")[["r8s"]]
expect_length(multiPhylo, 3)
})
test_that("raxml readInput works", {
filepath = system.file("extdata", "raxml.H3", package="phylogetree")
expect_equal(readInput(filepath, "raxml")[["raxml"]]@file, filepath)
})
test_that("nhx readInput works", {
filepath = system.file("extdata", "nhx.nhx", package="phylogetree")
expect_equal(readInput(filepath, "nhx")[["nhx"]]@file, filepath)
})
test_that("phylip readInput works", {
filepath = system.file("extdata", "phylip.phy", package="phylogetree")
expect_equal(readInput(filepath, "phylip")[["phylip"]]@file, filepath)
})
test_that("phylip readInput works", {
filepath = system.file("extdata", "epa.jplace", package="phylogetree")
expect_equal(readInput(filepath, "epa")[["epa"]]@file, filepath)
})
# ==== BEGIN TEARDOWN AND RESTORE ==============================================
rm(list=ls())
# ==== END TEARDOWN AND RESTORE ===============================================
# [END]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.