Commit | Line | Data |
---|---|---|
0486fbad | 1 | context("epclustFilter") |
6ad3f3fd | 2 | |
0486fbad BA |
3 | #TODO: find a better name |
4 | test_that("[time-]serie filtering behave as expected", | |
5 | { | |
6 | # Currently just a mean of 3 values | |
7 | M = matrix(runif(1000,min=-7,max=7), ncol=10) | |
8 | ref_fM = stats::filter(M, c(1/3,1/3,1/3), circular=FALSE) | |
9 | fM = epclust:::.epclustFilter(M) | |
10 | ||
11 | #Expect an agreement on all inner values | |
12 | expect_equal(dim(fM), c(100,10)) | |
13 | expect_equal(fM[2:99,], ref_fM[,2:99]) | |
14 | ||
15 | #For border values, just apply a "by-hand" mean | |
16 | expect_equal(fM[1,], colMeans(rbind(M[1,],M[2,],M[100,]))) | |
17 | expect_equal(fM[100,], colMeans(rbind(M[100,],M[99,],M[1,]))) | |
18 | } |