Skip to content

Commit

Permalink
add tests for frag.graph.reduce
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastien-plutniak committed Dec 25, 2024
1 parent 3335715 commit 2d019f8
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tests/testthat/test-frag.graph.reduce.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
test_that("preserve component number (objects nr preservation)", {
set.seed(1)
g1 <- frag.simul.process(1, 10, 41)
g2 <- frag.graph.reduce(g1, 30, conserve.objects.nr = T)
g3 <- frag.graph.reduce(g1, 40, conserve.objects.nr = T)

expect_identical(components(g1)$no, expected = components(g2)$no)
expect_identical(components(g1)$no, expected = components(g3)$no)
})



test_that("reduce vertice size (objects nr preservation)", {
set.seed(1)
g1 <- frag.simul.process(1, 10, 41)
g2 <- frag.graph.reduce(g1, 30, conserve.objects.nr = TRUE)

expect_identical(gorder(g2), 20)
})


test_that("reduce vertice size (no objects nr preservation)", {
set.seed(1)
g1 <- frag.simul.process(1, 10, 41)
g2 <- frag.graph.reduce(g1, 30, conserve.objects.nr = FALSE)

expect_identical(gorder(g2), 11)
})


0 comments on commit 2d019f8

Please # to comment.