[Phylobase-commits] r949 - pkg/tests/testthat

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu May 8 15:13:17 CEST 2014


Author: francois
Date: 2014-05-08 15:13:17 +0200 (Thu, 08 May 2014)
New Revision: 949

Added:
   pkg/tests/testthat/test.treestruc.R
Log:
move/convert treestruc to testthat

Copied: pkg/tests/testthat/test.treestruc.R (from rev 880, pkg/inst/unitTests/runit.treestruc.R)
===================================================================
--- pkg/tests/testthat/test.treestruc.R	                        (rev 0)
+++ pkg/tests/testthat/test.treestruc.R	2014-05-08 13:13:17 UTC (rev 949)
@@ -0,0 +1,30 @@
+#
+# --- Test treestruc.R functions ---
+#
+
+context("tree structures")
+
+test_that("hasPoly", {
+    # construct simple polytomy
+    owls <- ape::read.tree(text =
+        "((Strix_aluco:4.2,Asio_otus:4.2):3.1,Athene_noctua:7.3);")
+    owls$edge <- matrix(c(4,4,4,1,2,3), ncol=2)
+    owls$Nnode <- 1
+    owls$edge.length <- owls$edge.length[-4]
+    tr <- as(owls, "phylo4")
+    expect_true(hasPoly(tr))
+    # test against empty tree
+    expect_true(!hasPoly(new("phylo4")))
+})
+
+
+test_that("hasSingle", {
+    # test against empty tree
+    expect_true(!hasSingle(new("phylo4")))
+})
+
+test_that("hasRetic", {
+    # test against empty tree
+    expect_true(!hasRetic(new("phylo4")))
+})
+



More information about the Phylobase-commits mailing list