context("CSTools::CST_RFSlope tests")

##############################################
# dat1
data <- rnorm(2 * 10 * 4 * 5 * 6 * 7)
dim(data) <- c(dataset = 2, member = 10,
                sdate = 4, ftime = 5, lat = 6, lon = 7)
lon <- seq(0, 12, 2)
lat <- seq(10, 15, 1)
coords <- list(lon = lon, lat = lat)
exp <- list(data = data, coords = coords)
attr(exp, "class") <- "s2dv_cube"

# dat2
exp2_3 <- exp
names(dim(exp2_3$data)) <- c("dataset", "member", "sdate", "ftime", "lati", "loni")

##############################################
test_that("1. Input checks", {
  # Check 's2dv_cube'
  expect_error(
    CST_RFSlope(rnorm(2 * 15 * 4 * 5 * 6 * 7)),
    paste0("Parameter 'data' must be of the class 's2dv_cube', ",
           "as output by CSTools::CST_Load.")
  )
  # Check dimensions
  expect_error(
    CST_RFSlope(exp2_3),
    paste0("Spatial dimension names do not match any of the names accepted by ",
           "the package.")
  )
})
