fix tests
[talweg.git] / pkg / tests / testthat / test-similarDays.R
1 context("Get similar days")
2
3 test_that("getSimilarDaysIndices works as expected",
4 {
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))
19 })
20
21 test_that("getConstrainedNeighbs works as expected",
22 {
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
26 })
27