Commit 41582068 authored by Delaigue Olivier's avatar Delaigue Olivier
Browse files

test(PE_Oudin): add test when TimeStepIn = "hourly" and Julian days not ordered

Refs #134
parent deb106d7
Pipeline #26050 canceled with stage
......@@ -4,6 +4,7 @@ context("Test evaporation")
rm(list = ls())
data(L0123001); BasinObs_L0123001 <- BasinObs
data(L0123002); BasinObs_L0123002 <- BasinObs
data(L0123003); BasinObs_L0123003 <- BasinObs
comp_evap <- function(BasinObs,
Lat, LatUnit,
......@@ -65,7 +66,8 @@ test_that("PE_Oudin works", {
test_that("Inconsitent time series", {
skip_on_cran()
warnDaily <- "each day should have only one identical value of julian days. The time series is not sorted, or contains duplicate or missing dates"
msgDaily <- "each day should have only one identical value of julian days. The time series is not sorted, or contains duplicate or missing dates"
msgHoury <- "each day must have 24 identical values of julian days (one for each hour). The time series is not sorted, or contains duplicate or missing dates"
# duplicated dates
DatesFor1Dupl <- BasinObs_L0123001$DatesR
......@@ -73,14 +75,22 @@ test_that("Inconsitent time series", {
expect_warning(object = PE_Oudin(JD = as.POSIXlt(DatesFor1Dupl)$yday + 1,
Temp = BasinObs_L0123001$T,
Lat = 0.8, LatUnit = "rad"),
regexp = warnDaily)
regexp = msgDaily)
# not ordered dates
# not ordered daily dates
DatesFor1Messy <- sample(BasinObs_L0123001$DatesR)
expect_warning(object = PE_Oudin(JD = as.POSIXlt(DatesFor1Messy)$yday + 1,
Temp = BasinObs_L0123001$T,
Lat = 0.8, LatUnit = "rad"),
regexp = warnDaily)
regexp = msgDaily)
# not ordered hourly dates
DatesFor3Messy <- sample(BasinObs_L0123003$DatesR)
DatesFor3Messy <- DatesFor3Messy[-5L]
expect_error(object = PE_Oudin(JD = as.POSIXlt(DatesFor3Messy)$yday + 1,
Temp = seq_along(BasinObs_L0123003$T)[-5L],
Lat = 0.8, LatUnit = "rad", TimeStepIn = "hourly"),
regexp = msgHoury, fixed = TRUE)
})
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment