tests/testthat/test-difftime_compare.R

context("difftime_compare")

from <- as.POSIXct("2021-01-04 09:00:00", tz = "UTC")
to <- as.POSIXct("2021-01-04 18:00:00", tz = "UTC")

test_that("difftime_compare works", {
	expect_equal(difftime_compare(from, to, "5 mins"), "greater")
	expect_equal(difftime_compare(from, to, "5 hours"), "greater")
	expect_equal(difftime_compare(from, to, "5 days"), "smaller")
	expect_error(difftime_compare(from, to, "5days"))
})

Try the dispositionEffect package in your browser

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

dispositionEffect documentation built on May 30, 2022, 9:05 a.m.