all set-up to prepare ultimate test before last reports
[talweg.git] / pkg / tests / testthat / test.dateIndexToInteger.R
1 context("Check that dateIndexToInteger behaves as expected")
2
3 test_that("computed integer index is correct; 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( dateIndexToInteger("2008-12-10",data), 1 )
8 expect_identical( dateIndexToInteger("2008-12-11",data), 2 )
9 expect_identical( dateIndexToInteger("2008-12-20",data), 11 )
10 expect_identical( dateIndexToInteger("2009-02-01",data), 53 )
11 expect_identical( dateIndexToInteger("2009-03-01",data), 81 )
12 expect_identical( dateIndexToInteger("2009-05-31",data), 172 )
13 })
14
15 test_that("computed integer index is correct; 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( dateIndexToInteger("2008-12-10",data), 2 )
20 expect_identical( dateIndexToInteger("2008-12-11",data), 3 )
21 expect_identical( dateIndexToInteger("2008-12-20",data), 12 )
22 expect_identical( dateIndexToInteger("2009-02-01",data), 54 )
23 expect_identical( dateIndexToInteger("2009-03-01",data), 82 )
24 expect_identical( dateIndexToInteger("2009-05-31",data), 173 )
25 }