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