Commit | Line | Data |
---|---|---|
3ddf1c12 BA |
1 | context("Get similar days") |
2 | ||
c36568fa | 3 | test_that("getSimilarDaysIndices works as expected", |
3ddf1c12 | 4 | { |
c36568fa BA |
5 | data = getDataTest(150) |
6 | ||
7 | # Index 142 is a tuesday (142 = 2 mod 7) | |
8 | N142_1 = getSimilarDaysIndices(142, data, limit=7, same_season=FALSE, days_in=NULL) | |
9 | expect_equal(N142_1, c(141,137,136,135,134,130,129)) | |
10 | # Index 139 = saturday | |
11 | N139_1 = getSimilarDaysIndices(139, data, limit=7, same_season=FALSE, days_in=NULL) | |
12 | expect_equal(N139_1, c(132,125,118,111,104,97,90)) | |
13 | ||
14 | # With 'days_in' constraint | |
15 | N142_2 = getSimilarDaysIndices(142, data, limit=7, same_season=FALSE, days_in=2*(1:75)) | |
16 | expect_equal(N142_2, c(136,134,130,128,122,120,116)) | |
17 | N139_2 = getSimilarDaysIndices(139, data, limit=7, same_season=FALSE, days_in=2*(1:75)) | |
18 | expect_equal(N139_2, c(132,118,104,90,76,62,48)) | |
3ddf1c12 | 19 | }) |
3ddf1c12 | 20 | |
c36568fa | 21 | test_that("getConstrainedNeighbs works as expected", |
3ddf1c12 | 22 | { |
c36568fa BA |
23 | # data = getDataTest(150) |
24 | # N142_1 = .getConstrainedNeighbs(142, data, fdays, min_neighbs=7, max_neighbs=7) | |
25 | # #...maybe we need an easier test data | |
3ddf1c12 BA |
26 | }) |
27 |