From: Benjamin Auder Date: Thu, 23 Feb 2017 09:44:19 +0000 (+0100) Subject: tests presque OK X-Git-Url: https://git.auder.net/%7B%7B%20asset%28%27mixstore/css/form.css%27%29%20%7D%7D?a=commitdiff_plain;h=defcae035f2e26fd8568cedb27040b173811b246;p=talweg.git tests presque OK --- diff --git a/pkg/tests/testthat/test.Forecaster.R b/pkg/tests/testthat/test.Forecaster.R index 6387827..945320c 100644 --- a/pkg/tests/testthat/test.Forecaster.R +++ b/pkg/tests/testthat/test.Forecaster.R @@ -6,8 +6,9 @@ data00 <<- getData(ts_data, exo_data, input_tz="GMT", date_format="%Y-%m-%d %H:% working_tz="GMT", predict_at=0, limit=Inf) data13 <<- getData(ts_data, exo_data, input_tz="GMT", date_format="%Y-%m-%d %H:%M", working_tz="GMT", predict_at=13, limit=Inf) -#Forecast at sunday to saturday, for monday to sunday +#Forecast at sunday to saturday (series 7 to 1), for monday to sunday (series 1 to 7) indices <<- seq(as.Date("2007-04-01"),as.Date("2007-04-07"),"days") +pred_order = c(7,1:6) #will facilitate tests test_that("Average method behave as expected", { @@ -16,9 +17,9 @@ test_that("Average method behave as expected", for (i in seq_along(indices)) { #zero jump: should predict true values minus 1 - expect_identical(pred00_z$getSerie(i), rep(i,24)) + expect_equal(pred00_z$getSerie(i), rep(pred_order[i],24)) #persistence jump == 1: should predict true values - expect_identical(pred00_p$getSerie(i), rep(i%%7+1,24)) + expect_equal(pred00_p$getSerie(i), rep(i,24)) } #NOTE: days become @@ -29,7 +30,7 @@ test_that("Average method behave as expected", prediction = c(rep(-13/24,11),rep(11/24,13)) for (i in seq_along(indices)) { - expect_equal(pred13_z$getSerie(i), prediction ) + expect_equal(pred13_z$getSerie(i), prediction ) ##TODO: prendre en compte recollement expect_equal(pred13_p$getSerie(i), prediction ) }