code seems OK; still wavelets test to write
[epclust.git] / epclust / tests / testthat / test.filter.R
CommitLineData
a52836b2 1context("filterMA")
6ad3f3fd 2
0486fbad
BA
3test_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)
a52836b2 8 fM = epclust:::filterMA(M)
0486fbad 9
a52836b2 10 # Expect an agreement on all inner values
0486fbad 11 expect_equal(dim(fM), c(100,10))
0fe757f7 12 expect_equal(fM[2:99,], ref_fM[2:99,])
0486fbad 13
a52836b2 14 # Border values should be unchanged
0fe757f7
BA
15 expect_equal(fM[1,], M[1,])
16 expect_equal(fM[100,], M[100,])
17})