Skip to content

Commit

Permalink
Add snapshot test
Browse files Browse the repository at this point in the history
  • Loading branch information
krlmlr committed Mar 31, 2023
1 parent f8be82d commit e8ef647
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 0 deletions.
41 changes: 41 additions & 0 deletions tests/testthat/_snaps/graph.bfs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# snapshot test

Code
g <- graph_from_literal(a - +b - +c)
bfs(g, root = 2, mode = "out", unreachable = FALSE, order = TRUE, rank = TRUE,
father = TRUE, pred = TRUE, succ = TRUE, dist = TRUE)
Output
$root
[1] 2
$mode
[1] "out"
$order
+ 3/3 vertices, named:
[1] b c <NA>
$rank
a b c
NaN 1 2
$father
+ 3/3 vertices, named:
[1] a b c
$pred
+ 3/3 vertices, named:
[1] a b c
$succ
+ 3/3 vertices, named:
[1] a b c
$dist
a b c
NaN 0 1
$neimode
[1] "out"

20 changes: 20 additions & 0 deletions tests/testthat/test-graph.bfs.R
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,23 @@ test_that("BFS callback does not blow up when another igraph function is raised

expect_true(TRUE)
})

test_that("snapshot test", {
local_igraph_options(print.id = FALSE)

expect_snapshot({
g <- graph_from_literal(a -+ b -+ c)
bfs(
g,
root = 2,
mode = "out",
unreachable = FALSE,
order = TRUE,
rank = TRUE,
father = TRUE,
pred = TRUE,
succ = TRUE,
dist = TRUE
)
})
})

0 comments on commit e8ef647

Please sign in to comment.