ignore HTML generated vignettes (Rmarkdown)
[talweg.git] / pkg / tests / testthat / test.integerIndexToDate.R
1 context("Check that integerIndexToDate behaves as expected")
2
3 test_that("computed dates match the input indexes; predict_at == 0",
4 {
5 data0 = getData(ts_data="pm10_mesures_H_loc.csv", exo_data="meteo_extra_noNAs.csv",
6 input_tz="Europe/Paris",working_tz="Europe/Paris", predict_at=0, limit=200)
7 expect_identical( integerIndexToDate(1,data), as.Date("2008-12-10") )
8 expect_identical( integerIndexToDate(2,data), as.Date("2008-12-11") )
9 expect_identical( integerIndexToDate(11,data), as.Date("2008-12-20") )
10 expect_identical( integerIndexToDate(53,data), as.Date("2009-02-01") )
11 expect_identical( integerIndexToDate(81,data), as.Date("2009-03-01") )
12 expect_identical( integerIndexToDate(172,data), as.Date("2009-05-31") )
13 })
14
15 test_that("computed dates match the input indexes; predict_at > 0",
16 {
17 data7 = getData(ts_data="pm10_mesures_H_loc.csv", exo_data="meteo_extra_noNAs.csv",
18 input_tz="Europe/Paris",working_tz="Europe/Paris", predict_at=7, limit=200)
19 expect_identical( integerIndexToDate(2,data), as.Date("2008-12-10") )
20 expect_identical( integerIndexToDate(3,data), as.Date("2008-12-11") )
21 expect_identical( integerIndexToDate(12,data), as.Date("2008-12-20") )
22 expect_identical( integerIndexToDate(54,data), as.Date("2009-02-01") )
23 expect_identical( integerIndexToDate(82,data), as.Date("2009-03-01") )
24 expect_identical( integerIndexToDate(173,data), as.Date("2009-05-31") )
25 }