diff --git a/.DS_Store b/.DS_Store index 3601b412..30ab1f60 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/inst/tests/test-decimal-date.R b/inst/tests/test-decimal-date.R index 6ad2173d..b3aee429 100644 --- a/inst/tests/test-decimal-date.R +++ b/inst/tests/test-decimal-date.R @@ -12,3 +12,9 @@ test_that("decimal_date works handles vectors",{ expect_that(round(decimal_date(x), 3), equals(c(2008.589, 2009.587))) }) + +test_that("decimal_date handles first second of year without returning NaN",{ + + expect_equal(decimal_date(ymd("2012-01-01")), 2012) + +}) \ No newline at end of file diff --git a/inst/tests/test-round.R b/inst/tests/test-round.R index 8bfcdd63..25c02673 100644 --- a/inst/tests/test-round.R +++ b/inst/tests/test-round.R @@ -186,4 +186,22 @@ test_that("floor_date does not round down dates that are already on a boundary", test_that("round_date does not round dates that are already on a boundary",{ expect_equal(round_date(as.Date("2012-09-27"), 'day'), as.Date("2012-09-27")) +}) + +test_that("ceiling_date returns input of length zero when given input of length zero",{ + x <- structure(vector(mode = "numeric"), class = c("POSIXct", "POSIXt")) + + expect_equal(ceiling_date(x), x) +}) + +test_that("floor_date returns input of length zero when given input of length zero",{ + x <- structure(vector(mode = "numeric"), class = c("POSIXct", "POSIXt")) + + expect_equal(floor_date(x), x) +}) + +test_that("round_date returns input of length zero when given input of length zero",{ + x <- structure(vector(mode = "numeric"), class = c("POSIXct", "POSIXt")) + + expect_equal(round_date(x), x) }) \ No newline at end of file diff --git a/inst/tests/test-update.R b/inst/tests/test-update.R index 2762bf03..75f93c96 100644 --- a/inst/tests/test-update.R +++ b/inst/tests/test-update.R @@ -410,3 +410,15 @@ test_that("update handles gives error for non-conformable vectors of inputs",{ expect_that(day(update(date, days = c(1,2), months = c(1,2,3))), throws_error()) }) + +test_that("update.POSIXct returns input of length zero when given input of length zero",{ + x <- structure(vector(mode = "numeric"), class = c("POSIXct", "POSIXt")) + + expect_equal(update(x, days = 1), x) +}) + +test_that("update.POSIXlt returns input of length zero when given input of length zero",{ + x <- as.POSIXlt(structure(vector(mode = "numeric"), class = c("POSIXct", "POSIXt"))) + + expect_equal(update(x, days = 1), x) +}) \ No newline at end of file