Closed zkamvar closed 5 years ago
Note that using saved references for these tests is a bit ham-fisted since it's much easier for someone to accidentally overwrite the binaries if they are moving too fast (which @jrcpulliam was successful at avoiding in 134b0c57ffd0e22e4dcaca377c558caf03c62992 ^_^). My plan for this fix is to re-write these tests so that they don't rely on the saved binaries.
As usual, this was a PBKC-type error β¨οΈ π€¦ββοΈ, aka Zhian trying to be too clever:
The above code shows a couple of things:
dat
and enforce that I always have 2015-12-28library("incidence")
test_seed <- function(i) {
the_seed <- eval(parse(text = as.character(i)))
cat("seed: ", the_seed, "\n")
set.seed(the_seed)
dat <- as.integer(c(-3, sample(-3:100, 50, replace = TRUE)))
dat_dates <- as.Date("2015-12-31") + dat
incidence(dat_dates, interval = 7)
}
test_seed("2019-01-08")
#> seed: 2010
#> <incidence object>
#> [51 cases from days 2015-12-28 to 2016-04-04]
#> [51 cases from ISO weeks 2015-W53 to 2016-W14]
#>
#> $counts: matrix with 15 rows and 1 columns
#> $n: 51 cases in total
#> $dates: 15 dates marking the left-side of bins
#> $interval: 7 days
#> $timespan: 99 days
#> $cumulative: FALSE
test_seed("2019-01-03")
#> seed: 2015
#> <incidence object>
#> [51 cases from days 2015-12-28 to 2016-03-28]
#> [51 cases from ISO weeks 2015-W53 to 2016-W13]
#>
#> $counts: matrix with 14 rows and 1 columns
#> $n: 51 cases in total
#> $dates: 14 dates marking the left-side of bins
#> $interval: 7 days
#> $timespan: 92 days
#> $cumulative: FALSE
Created on 2019-01-08 by the reprex package (v0.2.1)
I was emailed a few days ago about tests that are intermittently failing on cached objects. The troubling thing about these failures is that they appear to add an extra week to the dates. I'm not sure why these appeared and how to reproduce since travis seems to be working fine.... wait... I had changed the repo to be checked on travis monthly as opposed to weekly π