- # index 142 : serie type 2
- f2 = computeFilaments(data, 142, limit=60, plot=FALSE)
- # Expected output: 22 series of type 3 (closer), then 50-2-10 series of type 2
- #
- #
- #
- #
- #
- #
- # Simulate shift at origin when predict_at > 0
- series[2:(n+1)] = series[1:n]
- series[[1]] = list("level"=0, "serie"=s[[1]][1:(L%/%2)])
- # index 143 : serie type 3
- f3 = computeFilaments(data, 143, limit=70, plot=FALSE)
- # Expected output: 22 series of type 2 (closer) then 50-2 series of type 3
- # ATTENTION au shift
- #
- #
- # index 144 : serie type 1
- f1 = computeFilaments(data, 144, limit=50, plot=FALSE)
- # Expected output: 2 series of type 3 (closer), then 50-2 series of type 1
- #
- expect_that( diff_norm, is_less_than(0.5) )
+ # index 142 : serie type 1
+ f = computeFilaments(data, 142, limit=50, plot=FALSE)
+ # Expected output: 13 series of type 3 (closer), then 50-10-3 series of type 1, then 142
+ # NOTE: -10 because only past days with no-NAs tomorrow => exclude type 1 in [60,90[
+ expect_identical(length(f$indices), as.integer(51))
+ expect_identical(length(f$colors), as.integer(51))
+ expect_true(all(I(f$indices) != 2))
+ for (i in 1:13)
+ {
+ expect_equal(I(f$indices[i]), 3)
+ expect_match(f$colors[i], f$colors[1])
+ }
+ for (i in 14:50)
+ {
+ expect_equal(I(f$indices[i]), 1)
+ expect_match(f$colors[i], f$colors[14])
+ }
+ expect_equal(f$indices[51], 142)
+ expect_match(f$colors[51], "#FF0000")
+ expect_match(f$colors[1], "#E*")
+ expect_match(f$colors[14], "#1*")