tests/testthat/test-feb29-to-28.R

context("feb29-to-28")

test_that("feb29_to_28.Date", {
  expect_identical(
    dtt_feb29_to_28(as.Date("2004-02-29")),
    as.Date("2004-02-28")
  )
  expect_identical(
    dtt_feb29_to_28(as.Date(c("2004-02-29", "2003-03-01"))),
    as.Date(c("2004-02-28", "2003-03-01"))
  )
})


test_that("feb29_to_28.POSIXct", {
  expect_identical(
    dtt_feb29_to_28(as.POSIXct("2004-02-29")),
    as.POSIXct("2004-02-28")
  )
  expect_identical(
    dtt_feb29_to_28(as.POSIXct(c("2004-02-29", "2003-03-01"))),
    as.POSIXct(c("2004-02-28", "2003-03-01"))
  )
})

Try the dttr2 package in your browser

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

dttr2 documentation built on July 10, 2020, 5:06 p.m.