tests presque OK
authorBenjamin Auder <benjamin.auder@somewhere>
Thu, 23 Feb 2017 09:44:19 +0000 (10:44 +0100)
committerBenjamin Auder <benjamin.auder@somewhere>
Thu, 23 Feb 2017 09:44:19 +0000 (10:44 +0100)
pkg/tests/testthat/test.Forecaster.R

index 6387827..945320c 100644 (file)
@@ -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 )
        }