[Phylobase-commits] r469 - pkg/inst/unitTests
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Aug 18 20:06:25 CEST 2009
Author: regetz
Date: 2009-08-18 20:06:24 +0200 (Tue, 18 Aug 2009)
New Revision: 469
Modified:
pkg/inst/unitTests/runit.phylo.R
pkg/inst/unitTests/runit.setAs.R
pkg/inst/unitTests/runit.treewalk.R
Log:
updated original RUnit tests to reflect changes after fm-branch merge
Modified: pkg/inst/unitTests/runit.phylo.R
===================================================================
--- pkg/inst/unitTests/runit.phylo.R 2009-08-18 17:31:17 UTC (rev 468)
+++ pkg/inst/unitTests/runit.phylo.R 2009-08-18 18:06:24 UTC (rev 469)
@@ -31,25 +31,26 @@
tr$node.label <- 1:4
# can't keep invalid node labels
- checkException(phylo4(tr))
- checkException(phylo4(tr, check.node.labels="keep"))
- checkException(phylo4d(tr))
- checkException(phylo4d(tr, check.node.labels="keep"))
+# TODO: remove/modify these after fm-branch merge
+# checkException(phylo4(tr))
+# checkException(phylo4(tr, check.node.labels="keep"))
+# checkException(phylo4d(tr))
+# checkException(phylo4d(tr, check.node.labels="keep"))
# import to phylo4, dropping node labels
tmp <- phylo4(tr, check.node.labels="drop")
- checkEquals(length(tmp at node.label), 0)
+ checkTrue(all(is.na(tmp at node.label)))
# import to phylo4d, dropping node labels
tmp <- phylo4d(tr, check.node.labels="drop")
- checkEquals(length(tmp at node.label), 0)
+ checkTrue(all(is.na(tmp at node.label)))
checkEquals(nrow(tdata(tmp)), 0)
# import to phylo4d, converting node labels to data
tmp <- phylo4d(tr, check.node.labels="asdata")
checkEquals(tdata(tmp, "internal", label.type="column")$labelValues,
1:4)
- checkEquals(length(tmp at node.label), 0)
+ checkTrue(all(is.na(tmp at node.label)))
}
test.phylo.import.2tips <- function() {
Modified: pkg/inst/unitTests/runit.setAs.R
===================================================================
--- pkg/inst/unitTests/runit.setAs.R 2009-08-18 17:31:17 UTC (rev 468)
+++ pkg/inst/unitTests/runit.setAs.R 2009-08-18 18:06:24 UTC (rev 469)
@@ -12,11 +12,11 @@
checkTrue(is.data.frame(as(phy, "data.frame")))
phy.df <- structure(list(label = c(NA, NA, NA, NA, "spA", "spB",
"spC", "spD", "spE"), node = c(6L, 7L, 8L, 9L, 1L, 2L, 3L, 4L,
- 5L), ancestr = c(NA, 6L, 7L, 8L, 8L, 9L, 9L, 7L, 6L),
+ 5L), ancestor = c(NA, 6L, 7L, 8L, 8L, 9L, 9L, 7L, 6L),
edge.length = c(0.4, 0.2, 0.5, 0.15, 0.2, 0.1, 0.1, 0.7, 1),
node.type = structure(c(2L, 1L, 1L, 1L, 3L, 3L, 3L, 3L, 3L),
.Label = c("internal", "root", "tip"), class = "factor")),
- .Names = c("label", "node", "ancestr", "edge.length",
+ .Names = c("label", "node", "ancestor", "edge.length",
"node.type"), row.names = c(6L, 7L, 8L, 9L, 1L, 2L, 3L, 4L, 5L),
class = "data.frame")
checkEquals(as(phy, "data.frame"), phy.df)
Modified: pkg/inst/unitTests/runit.treewalk.R
===================================================================
--- pkg/inst/unitTests/runit.treewalk.R 2009-08-18 17:31:17 UTC (rev 468)
+++ pkg/inst/unitTests/runit.treewalk.R 2009-08-18 18:06:24 UTC (rev 469)
@@ -28,7 +28,7 @@
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) <- c("xxx", "yyy")
+ 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"))
@@ -37,7 +37,7 @@
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)
+ 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)
More information about the Phylobase-commits
mailing list