tests/testthat/test-parse_period.R

test_that("parse_period works", {
  expect_snapshot(error = TRUE, parse_period(c(1, 2)))
  expect_snapshot(error = TRUE, parse_period(c(1.3)))
  expect_snapshot(error = TRUE, parse_period("1 year"))
  expect_snapshot(error = TRUE, parse_period("2 weeks later"))
  expect_identical(parse_period(1), 1L)
  expect_identical(parse_period("1 day"), 1L)
  expect_identical(parse_period("1 days"), 1L)
  expect_identical(parse_period("1 week"), 7L)
  expect_identical(parse_period("1 weeks"), 7L)
  expect_identical(parse_period("2 weeks"), 14L)
})
cmu-delphi/epipredict documentation built on March 5, 2025, 12:17 p.m.