code seems OK; still wavelets test to write
[epclust.git] / epclust / tests / testthat / test.filter.R
1 context("filterMA")
2
3 test_that("[time-]serie filtering behave as expected",
4 {
5 # Currently just a mean of 3 values
6 M = matrix(runif(1000,min=-7,max=7), ncol=10)
7 ref_fM = stats::filter(M, c(1/3,1/3,1/3), circular=FALSE)
8 fM = epclust:::filterMA(M)
9
10 # Expect an agreement on all inner values
11 expect_equal(dim(fM), c(100,10))
12 expect_equal(fM[2:99,], ref_fM[2:99,])
13
14 # Border values should be unchanged
15 expect_equal(fM[1,], M[1,])
16 expect_equal(fM[100,], M[100,])
17 })