tests/testthat/test-length.R

test_that("length of directed graph", {
  graph <- graph_builder() |>
    add_path(c("1", "2", "3")) |>
    build_directed()

  expect_equal(length(graph), 3)
})

test_that("length of directed acyclic graph", {
  graph <- graph_builder() |>
    add_path(c("1", "2", "3")) |>
    build_acyclic()

  expect_equal(length(graph), 3)
})

test_that("length of graph builder is always 1", {
  expect_warning(length(graph_builder()))
  suppressWarnings({
    expect_equal(length(graph_builder()), 1)
  })
})

Try the orbweaver package in your browser

Any scripts or data that you put into this service are public.

orbweaver documentation built on June 8, 2025, 11:40 a.m.