forked from hyginn/rete
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More tests of importNet.STRING(); added test for igraph::simplify() i…
…n .df2gG()
- Loading branch information
Showing
1 changed file
with
21 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,32 @@ | ||
# testMultiply.R | ||
# testImport.R | ||
# | ||
# | ||
context("import networks") | ||
|
||
test_that("importNet.STRING reads STRING data", { | ||
test_that("importNet.STRING produces gG from STRING data", { | ||
gG <- importNet.STRING(fName = "dataString.txt", | ||
net = "experimental", | ||
silent = TRUE, | ||
noLog = TRUE) | ||
expect_equal(igraph::vcount(gG), 5) | ||
expect_equal(igraph::vcount(gG), 5) # correct number of vertices | ||
expect_equal(igraph::ecount(gG), 4) # correct number of edges | ||
expect_equal(igraph::graph_attr(gG)$gGversion, "1.0") # correct version | ||
expect_equal(igraph::graph_attr(gG)$inFile, "dataString.txt") # metadata | ||
# has been | ||
# set | ||
}) | ||
|
||
test_that(".df2gG simplifies the graph", { | ||
netDF <- data.frame(a = c("crow", "duck", "crow", "crow"), | ||
b = c("duck", "crow", "duck", "crow"), | ||
weight = c(1, 2, 3, 4), | ||
stringsAsFactors = FALSE) | ||
gG <- .df2gG(inFile = "dummy.txt", call = "dummy(arg = 1)") | ||
expect_equal(igraph::vcount(gG), 2) # only duck and crow | ||
expect_equal(igraph::ecount(gG), 2) # 1 duplicate, 1 self-edge removed | ||
expect_equal(igraph::edge_attr(gG)$weight, c(3, 2)) # correct weights | ||
}) | ||
|
||
|
||
|
||
# [END] |