+
+#NOTE: rather redundant test
+#test_that("clusteringTask1 + clusteringTask2 behave as expected",
+#{
+# n = 900
+# x = seq(0,9.5,0.1)
+# L = length(x) #96 1/4h
+# K1 = 60
+# K2 = 3
+# s = lapply( seq_len(K1), function(i) x^(1+i/30)*cos(x+i) )
+# series = matrix(nrow=n, ncol=L)
+# for (i in seq_len(n))
+# series[i,] = s[[I(i,K1)]] + rnorm(L,sd=0.01)
+# getSeries = function(indices) {
+# indices = indices[indices <= n]
+# if (length(indices)>0) series[indices,] else NULL
+# }
+# wf = "haar"
+# ctype = "absolute"
+# getContribs = function(indices) curvesToContribs(series[indices,],wf,ctype)
+# require("bigmemory", quietly=TRUE)
+# indices1 = clusteringTask1(1:n, getContribs, K1, 75, verbose=TRUE, parll=FALSE)
+# medoids_K1 = bigmemory::as.big.matrix( getSeries(indices1) )
+# medoids_K2 = clusteringTask2(medoids_K1, K2, getSeries, n, 120, verbose=TRUE, parll=FALSE)
+#
+# expect_equal(dim(medoids_K1), c(K1,L))
+# expect_equal(dim(medoids_K2), c(K2,L))
+# # Not easy to evaluate result: at least we expect it to be better than random selection of
+# # medoids within 1...K1 (among references)
+# distorGood = computeDistortion(series, medoids_K2)
+# for (i in 1:3)
+# expect_lte( distorGood, computeDistortion(series,medoids_K1[sample(1:K1, K2),]) )
+#})