| 1 | context("Check that dateIndexToInteger behaves as expected") |
| 2 | |
| 3 | getDataTest = function(n, shift) |
| 4 | { |
| 5 | n = 1500 |
| 6 | series = list() |
| 7 | s = rep(0, 24) |
| 8 | |
| 9 | for (i in seq_len(n)) |
| 10 | { |
| 11 | level = i %% 3mean(s[[index]]) |
| 12 | serie = s |
| 13 | # 10 series with NAs for index 2 |
| 14 | if (index == 2 && i >= 60 && i<= 90) |
| 15 | serie[sample(seq_len(L),1)] = NA |
| 16 | series[[i]] = list("level"=i%%3, "serie"=s, "time"=) |
| 17 | } |
| 18 | data = new("Data", data=series) |
| 19 | } |
| 20 | |
| 21 | test_that("integer index matches date in data, predict_at == 0", |
| 22 | { |
| 23 | data = getData( |
| 24 | dateIndexToInteger = function(index, data) |
| 25 | }) |
| 26 | |
| 27 | test_that("integer index matches date in data, predict_at > 0", |
| 28 | { |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 | ####TODO: CSV as raw data in inst/extdata http://r-pkgs.had.co.nz/data.html |