tests/testthat/test-cdb_id_stages.R

test_that("cdb_id_stages works correctly", {
  id1 <- cdb_id_stages(Compadre, "MatrixClassOrganized")
  expect_type(id1, "integer")
  expect_length(id1, nrow(Compadre@data))

  id2 <- cdb_id_stages(Compadre, "MatrixClassAuthor")
  expect_type(id2, "integer")
  expect_length(id2, nrow(Compadre@data))
})


test_that("cdb_id_stages warns and fails gracefully", {
  expect_error(cdb_id_stages(Compadre@data, "MatrixClassOrganized"))
  expect_error(cdb_id_stages(Compadre, "blah"))
})

Try the Rcompadre package in your browser

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

Rcompadre documentation built on Sept. 3, 2023, 1:07 a.m.