[Phylobase-commits] r627 - in pkg: R inst/unitTests

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Sep 9 06:48:31 CEST 2009


Author: regetz
Date: 2009-09-09 06:48:30 +0200 (Wed, 09 Sep 2009)
New Revision: 627

Modified:
   pkg/R/methods-phylo4.R
   pkg/inst/unitTests/runit.methods-phylo4.R
Log:
created unit test for new edgeId method


Modified: pkg/R/methods-phylo4.R
===================================================================
--- pkg/R/methods-phylo4.R	2009-09-09 04:33:51 UTC (rev 626)
+++ pkg/R/methods-phylo4.R	2009-09-09 04:48:30 UTC (rev 627)
@@ -13,10 +13,11 @@
 ###  3.1. nEdges()
 ###  3.2. edges()
 ###  3.3. edgeOrder()
-###  3.4. hasEdgeLength()
-###  3.5. edgeLength()
-###  3.6. edgeLength() <-
-###  3.7. sumEdgeLength()
+###  3.4. edgeId()
+###  3.5. hasEdgeLength()
+###  3.6. edgeLength()
+###  3.7. edgeLength() <-
+###  3.8. sumEdgeLength()
 
 ### 4. Root accessors
 ###  4.1. isRooted()

Modified: pkg/inst/unitTests/runit.methods-phylo4.R
===================================================================
--- pkg/inst/unitTests/runit.methods-phylo4.R	2009-09-09 04:33:51 UTC (rev 626)
+++ pkg/inst/unitTests/runit.methods-phylo4.R	2009-09-09 04:48:30 UTC (rev 627)
@@ -74,6 +74,15 @@
   checkIdentical(edgeOrder(reorder(phy, "postorder")), "postorder")
 }
 
+test.edgeId.phylo4 <- function() {
+  eid <- paste(ancestor, descendant, sep="-")
+  checkIdentical(edgeId(phy), eid)
+  checkIdentical(edgeId(phy, "all"), eid)
+  checkIdentical(edgeId(phy, "tip"), eid[descendant %in% nid.tip])
+  checkIdentical(edgeId(phy, "internal"), eid[!descendant %in% nid.tip])
+  checkIdentical(edgeId(phy, "root"), eid[is.na(ancestor)])
+}
+
 test.hasEdgeLength.phylo4 <- function() {
   checkTrue(hasEdgeLength(phy))
   phy at edge.length <- NA_real_



More information about the Phylobase-commits mailing list