Browse files

added unit test for subsetting intervals

  • Loading branch information...
1 parent d8144c8 commit 2293db1d8554aede8eac5213f8ac3bf86e9cb62f @garrettgman garrettgman committed Sep 21, 2012
Showing with 13 additions and 0 deletions.
  1. +13 −0 inst/tests/test-intervals.R
View
13 inst/tests/test-intervals.R
@@ -91,3 +91,16 @@ test_that("as.interval handles vector input", {
expect_equal(dint2, as.interval(days(1), c(a,b)))
})
+
+test_that("[<- can subset intervals", {
+ ints <- data.frame(spans = c(interval(ymd(20090201), ymd(20090101)),
+ interval(ymd(20090201), ymd(20090101))))
+ my_int <- interval(ymd(18800101), ymd(18810101))
+ ints[1,1] <- 31536000
+ ints[2,1] <- my_int
+ int2 <- interval(ymd(20090201), ymd(20100201))
+
+ expect_equal(ints[1,1], int2)
+ expect_equal(ints[2,1], my_int)
+
+})

0 comments on commit 2293db1

Please sign in to comment.