set-up tests
[talweg.git] / pkg / tests / testthat / test.dateIndexToInteger.R
CommitLineData
a65907cc 1context("Check that dateIndexToInteger behaves as expected")
1e20780e 2
a65907cc
BA
3test_that("integer index matches date in data",
4{
1e20780e 5
1e20780e 6
1e20780e 7
a65907cc 8#TODO: with and without shift at origin (so series values at least forst ones are required)
1e20780e 9
a65907cc
BA
10
11 n = 1500
12 series = list()
13 for (i in seq_len(n))
1e20780e 14 {
a65907cc
BA
15 index = (i%%3) + 1
16 level = mean(s[[index]])
17 serie = s[[index]] - level + rnorm(L,sd=0.05)
18 # 10 series with NAs for index 2
19 if (index == 2 && i >= 60 && i<= 90)
20 serie[sample(seq_len(L),1)] = NA
21 series[[i]] = list("level"=level,"serie"=serie) #no need for more :: si : time !!!
1e20780e 22 }
a65907cc 23 data = new("Data", data=series)
1e20780e 24
a65907cc
BA
25 dateIndexToInteger = function(index, data)
26})