merge with remote
[talweg.git] / pkg / tests / testthat / test-Forecaster.R
index 3f5cf9c..b961c68 100644 (file)
@@ -9,7 +9,7 @@ pred_order = c(7,1:6) #will facilitate tests
 
 test_that("Average method behave as expected",
 {
-       pred00_z = computeForecast(data_p, indices, "Average", "Zero", 1, Inf, 24, ncores=1)
+       pred00_z = computeForecast(data_p, indices, "Average", "LastValue", 1, Inf, 24, ncores=1)
        pred00_p = computeForecast(data_p, indices, "Average", "Persistence", 1, Inf, 24)
        for (i in 1:7)
        {
@@ -22,7 +22,7 @@ test_that("Average method behave as expected",
        #NOTE: 24h-block become
        #1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 (14h-->0h then 1h-->13h)
        #No jump between days, thus zero and persistence are equivalent (and correct)
-       pred13_z = computeForecast(data_p, indices, "Average", "Zero", 14, Inf, 24)
+       pred13_z = computeForecast(data_p, indices, "Average", "LastValue", 14, Inf, 24)
        pred13_p = computeForecast(data_p, indices, "Average", "Persistence", 14, Inf, 24)
        for (i in 1:7)
        {
@@ -40,9 +40,9 @@ test_that("Average method behave as expected",
 test_that("Persistence method behave as expected",
 {
        #Situation A: +Zero; (generally) correct if jump, wrong otherwise
-       pred00_sd = computeForecast(data_p, indices, "Persistence", "Zero", 1, Inf, 24,
+       pred00_sd = computeForecast(data_p, indices, "Persistence", "LastValue", 1, Inf, 24,
                ncores=1, same_day=TRUE)
-       pred00_dd = computeForecast(data_p, indices, "Persistence", "Zero", 1, Inf, 24,
+       pred00_dd = computeForecast(data_p, indices, "Persistence", "LastValue", 1, Inf, 24,
                ncores=1, same_day=FALSE)
        for (i in 1:7)
        {
@@ -50,9 +50,9 @@ test_that("Persistence method behave as expected",
                expect_equal(pred00_dd$getForecast(i), rep(pred_order[i],24))
        }
 
-       pred13_sd = computeForecast(data_p, indices, "Persistence", "Zero", 14, Inf, 24,
+       pred13_sd = computeForecast(data_p, indices, "Persistence", "LastValue", 14, Inf, 24,
                ncores=1, same_day=TRUE)
-       pred13_dd = computeForecast(data_p, indices, "Persistence", "Zero", 14, Inf, 24,
+       pred13_dd = computeForecast(data_p, indices, "Persistence", "LastValue", 14, Inf, 24,
                ncores=1, same_day=FALSE)
        for (i in 1:7)
        {
@@ -96,12 +96,12 @@ test_that("Persistence method behave as expected",
 test_that("Neighbors method behave as expected",
 {
        #Situation A: +Zero; correct if jump, wrong otherwise
-       pred00 = computeForecast(data_p, indices, "Neighbors", "Zero", 1, Inf, 24,
+       pred00 = computeForecast(data_p, indices, "Neighbors", "LastValue", 1, Inf, 24,
                simtype="mix", local=FALSE, window=c(1,1))
        for (i in 1:7)
                expect_equal(pred00$getForecast(i), rep(pred_order[i],24))
 
-       pred13 = computeForecast(data_p, indices, "Persistence", "Zero", 14, Inf, 24,
+       pred13 = computeForecast(data_p, indices, "Persistence", "LastValue", 14, Inf, 24,
                simtype="mix", local=FALSE, window=c(1,1))
        for (i in 1:7)
                expect_equal(pred13$getForecast(i), rep(i,24) )