tests/testthat/test-util_find_free_missing_code.R

test_that("util_find_free_missing_code works", {
  skip_on_cran()
  # Numeric codes
  x <- c(777,888,999)
  expected_next_code <-  1000
  expect_equal(util_find_free_missing_code(x), as.character(expected_next_code))

  # All values cannot be converted
  x <- c("abc", "def", NA, "ghi")
  expect_error(util_find_free_missing_code(x))

  # TODO: date-time values
})

Try the dataquieR package in your browser

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

dataquieR documentation built on May 29, 2024, 7:18 a.m.