tests/testthat/test-utils_time_keywords_translate.R

test_that("`utils_time_keywords_translate()` works", {

  expect_equal(utils_time_keywords_translate(keyword = "1000 years"), "millennia")
  expect_equal(utils_time_keywords_translate(keyword = "1000 y"), "millennia")
  expect_equal(utils_time_keywords_translate(keyword = "thousands"), "millennia")
  expect_equal(utils_time_keywords_translate(keyword = "year"), "years")
  expect_equal(utils_time_keywords_translate(keyword = "y"), "years")
  expect_equal(utils_time_keywords_translate(keyword = "d"), "days")
  expect_equal(utils_time_keywords_translate(keyword = "day"), "days")
  expect_equal(utils_time_keywords_translate(keyword = "s"), "seconds")
  expect_equal(utils_time_keywords_translate(keyword = "sec"), "seconds")

})

Try the distantia package in your browser

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

distantia documentation built on April 4, 2025, 5:42 a.m.