Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
krlmlr committed Oct 9, 2023
1 parent be1f858 commit f345abd
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/testthat/_snaps/graph.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,18 @@
Output
[1] "airlines|flights" "airports|flights" "flights|planes" "flights|weather"

# empty graph

Code
create_graph_from_dm(empty_dm())
Output
IGRAPH 1c33ea7 UN-- 0 0 --
+ attr: name (v/c)
+ edges from 1c33ea7 (vertex names):
Code
create_graph_from_dm(dm(x = tibble(a = 1)))
Output
IGRAPH 2b92189 UN-- 1 0 --
+ attr: name (v/c)
+ edges from 2b92189 (vertex names):

7 changes: 7 additions & 0 deletions tests/testthat/test-graph.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,10 @@ test_that("functions working with graphs do the right thing?", {
attr(igraph::E(create_graph_from_dm(nyc_comp())), "vnames")
})
})

test_that("empty graph", {
expect_snapshot({
create_graph_from_dm(empty_dm())
create_graph_from_dm(dm(x = tibble(a = 1)))
})
})

0 comments on commit f345abd

Please sign in to comment.