[Phylobase-commits] r559 - pkg/inst/unitTests

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Aug 21 22:33:15 CEST 2009


Author: regetz
Date: 2009-08-21 22:33:15 +0200 (Fri, 21 Aug 2009)
New Revision: 559

Modified:
   pkg/inst/unitTests/runit.methods-phylo4.R
   pkg/inst/unitTests/runit.setAs.R
   pkg/inst/unitTests/runit.subset.R
   pkg/inst/unitTests/runit.treestruc.R
   pkg/inst/unitTests/runit.treewalk.R
Log:
Updated several existing RUnit files to include (still mostly
placeholder) test functions for each function/method in the
corresponding source file in pkg/R/.


Modified: pkg/inst/unitTests/runit.methods-phylo4.R
===================================================================
--- pkg/inst/unitTests/runit.methods-phylo4.R	2009-08-21 20:14:13 UTC (rev 558)
+++ pkg/inst/unitTests/runit.methods-phylo4.R	2009-08-21 20:33:15 UTC (rev 559)
@@ -1,5 +1,5 @@
 #
-# --- Test phylo4 methods ---
+# --- Test methods-phylo4.R ---
 #
  
 # Create sample tree for testing (ape::phylo object)

Modified: pkg/inst/unitTests/runit.setAs.R
===================================================================
--- pkg/inst/unitTests/runit.setAs.R	2009-08-21 20:14:13 UTC (rev 558)
+++ pkg/inst/unitTests/runit.setAs.R	2009-08-21 20:33:15 UTC (rev 559)
@@ -1,11 +1,29 @@
 #
-# --- Test setAs methods ---
+# --- Test setAs-Methods.R ---
 #
  
 # Create sample tree for testing (ape::phylo object)
 tr <- read.tree(text="(((spA:0.2,(spB:0.1,spC:0.1):0.15):0.5,spD:0.7):0.2,spE:1):0.4;") 
 phy <- as(tr, "phylo4")
 
+test.phylo.As.phylo4 <- function() {
+}
+
+test.phylo.As.phylo4d <- function() {
+}
+
+test.multiPhylo.As.multiPhylo4 <- function() {
+}
+
+test.multiPhylo4.As.multiPhylo <- function() {
+}
+
+test.phylo4.As.phylo <- function() {
+}
+
+test.phylo4.As.phylog <- function() {
+}
+
 test.phylo4.As.data.frame <- function() {
 
     # rooted tree

Modified: pkg/inst/unitTests/runit.subset.R
===================================================================
--- pkg/inst/unitTests/runit.subset.R	2009-08-21 20:14:13 UTC (rev 558)
+++ pkg/inst/unitTests/runit.subset.R	2009-08-21 20:33:15 UTC (rev 559)
@@ -1,5 +1,5 @@
 #
-# --- Test subset methods ---
+# --- Test subset.R ---
 #
  
 # Create sample tree for testing (ape::phylo object)
@@ -39,3 +39,8 @@
     checkEquals(phyd, phyd[seq_len(nTips(phyd))])
 }
 
+test.extractTree <- function() {
+    phyd <- as(tr, "phylo4d")
+    phy <- as(tr, "phylo4")
+    checkEquals(phy, extractTree(phyd))
+}

Modified: pkg/inst/unitTests/runit.treestruc.R
===================================================================
--- pkg/inst/unitTests/runit.treestruc.R	2009-08-21 20:14:13 UTC (rev 558)
+++ pkg/inst/unitTests/runit.treestruc.R	2009-08-21 20:33:15 UTC (rev 559)
@@ -1,5 +1,5 @@
 #
-# --- Test treestruc functions ---
+# --- Test treestruc.R functions ---
 #
  
 test.hasPoly <- function() {
@@ -13,3 +13,9 @@
     checkTrue(hasPoly(tr))
 }
 
+test.hasSingle <- function() {
+}
+
+test.hasRetic <- function() {
+}
+

Modified: pkg/inst/unitTests/runit.treewalk.R
===================================================================
--- pkg/inst/unitTests/runit.treewalk.R	2009-08-21 20:14:13 UTC (rev 558)
+++ pkg/inst/unitTests/runit.treewalk.R	2009-08-21 20:33:15 UTC (rev 559)
@@ -1,21 +1,18 @@
 #
-# --- Test treewalk functions ---
+# --- Test treewalk.R functions ---
 #
 
-# Note: we're not explicitly testing missing="warn" condition below;
-# however, if "OK" and "fail" both work as expected, then so must "warn"
- 
 # Create sample phylo4 tree for testing
 tr <- read.tree(text="(((spA:0.2,(spB:0.1,spC:0.1):0.15):0.5,spD:0.7):0.2,spE:1):0.4;") 
 phy <- as(tr, "phylo4")
 
-test.getNode.valid.character <- function() {
+test.getNode <- function() {
+# Note: we're not explicitly testing missing="warn" condition below;
+# however, if "OK" and "fail" both work as expected, then so must "warn"
     # node only has valid characters
     checkEquals(getNode(phy, "spA"), c(spA=1))
     checkEquals(getNode(phy, c("spA", "spC")), c(spA=1, spC=3))
-}
 
-test.getNode.valid.integer <- function() {
     # node only has valid integers 
     ans <- 4
     names(ans) <- "spD"
@@ -23,42 +20,66 @@
     ans <- c(4,6)
     names(ans) <- c("spD", NA)
     checkEquals(getNode(phy, c(4,6)), ans)
-}
 
-test.getNode.missing.character <- function() {
     # node includes only missing characters (names), but missing=OK
     ans <- rep(NA_integer_, 2)  # return values should be NA
     names(ans) <- rep(NA, 2)  # return values should have NA names
     checkEquals(getNode(phy, c("xxx", "yyy"), missing="OK"), ans)
     # now missing = "fail"
     checkException(getNode(phy, c("xxx", "yyy"), missing="fail"))
-}
 
-test.getNode.missing.integer <- function() {
     # node includes only missing numbers (IDs), but missing=OK
     ans <- rep(NA_integer_, 3)  # return values should be NA
     names(ans) <- rep(NA, 3)  # return values should have NA names
     checkEquals(getNode(phy, c(-9, 0, 50), missing="OK"), ans)
     # now missing = "fail"
     checkException(getNode(phy, c(-9, 0, 50), missing="fail"), ans)
-}
 
-test.getNode.NAs <- function() {
     # node includes NAs, but missing = "OK"
     checkTrue(is.na(getNode(phy, NA_integer_, missing="OK")))
     checkTrue(is.na(getNode(phy, NA_character_, missing="OK")))
-}
 
-test.getNode.mixed.cases <- function() {
     # node includes mixture of valid values and NAs
     ans <- c(2, NA)
     names(ans) <- c("spB", NA) 
     checkEquals(getNode(phy, c("spB", NA), missing="OK"), ans)
     checkEquals(getNode(phy, c(2, NA), missing="OK"), ans)
-}
 
-test.getNode.invalid.nodes <- function() {
     # node is neither integer-like nor character
     checkException(getNode(phy, 1.5))
 }
 
+test.ancestor <- function() {
+    # function(phy,node)
+}
+
+test.children <- function() {
+    # function(phy,node)
+}
+
+test.descendants <- function() {
+    # function (phy, node, type=c("tips","children","all"))
+}
+
+test.siblings <- function() {
+    # function(phy, node, include.self=FALSE)
+}
+
+test.ancestors <- function() {
+    # function (phy, node, type=c("all","parent","ALL"))
+}
+
+test.MRCA <- function() {
+    # function(phy, ...)
+}
+
+test.shortestPath <- function() {
+    # function(phy, node1, node2)
+}
+
+test.getEdge <- function() {
+    # function(phy, node, type=c("node", "ancestor", "all"),
+    # output=c("otherEnd", "allEdge"), missing=c("warn", "OK", "fail"))
+}
+
+



More information about the Phylobase-commits mailing list