tests/testthat/test-cdb_id_studies.R

test_that("cdb_id_studies works correctly", {
  s1 <- cdb_id_studies(Compadre)
  expect_type(s1, "integer")
  expect_length(s1, nrow(Compadre@data))

  s2 <- cdb_id_studies(Compadre, c("Family", "MatrixPopulation"))
  expect_type(s2, "integer")
  expect_length(s2, nrow(Compadre@data))
  expect_false(all(s1 == s2))
})


test_that("cdb_id_studies warns and fails gracefully", {
  expect_error(cdb_id_studies(Compadre@data))
  expect_error(cdb_id_studies(Compadre, c("SpeciesAuthor", "blah")))
})

Try the Rcompadre package in your browser

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

Rcompadre documentation built on Oct. 17, 2024, 1:07 a.m.