diff --git a/DESCRIPTION b/DESCRIPTION index d4d986fda45c5b8a4bc8b5d409ce0aec964309a7..1eaa64689f6bd33bc493cfabf66d6346a2786fea 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -27,6 +27,7 @@ Suggests: knitr, rmarkdown, testthat, + tibble, htmlwidgets (>= 1.5.3) Description: Add-on package to the 'airGR' package that simplifies its use and is aimed at being used for teaching hydrology. The package provides 1) three functions that allow to complete very simply a hydrological modelling exercise 2) plotting functions to help students to explore observed data and to interpret the results of calibration and simulation of the GR ('Génie rural') models 3) a 'Shiny' graphical interface that allows for displaying the impact of model parameters on hydrographs and models internal variables. License: GPL-2 diff --git a/tests/testthat/test-PrepGR.R b/tests/testthat/test-PrepGR.R new file mode 100644 index 0000000000000000000000000000000000000000..54dd83009849675c4e771461f5b5550fc786d96f --- /dev/null +++ b/tests/testthat/test-PrepGR.R @@ -0,0 +1,34 @@ +context("PrepGR") + +# -------- + +library(tibble) + +# -------- + +data(L0123001, package = "airGR") + +BasinObs <- BasinObs[, c("DatesR", "P", "E", "Qmm", "T")] +BasinObs2 <- BasinObs +colnames(BasinObs2) <- letters[seq_along(colnames(BasinObs2))] + + +# -------- + +test_that("ObsDF with custom column names", { + expect_equal( + object = PrepGR(ObsDF = BasinObs, HydroModel = "GR4J", CemaNeige = FALSE) + , + expected = PrepGR(ObsDF = BasinObs2, HydroModel = "GR4J", CemaNeige = FALSE), + ) +}) + +# ---- + +test_that("ObsDF is a tibble data.frame", { + expect_equal( + object = PrepGR(ObsDF = BasinObs, HydroModel = "GR4J", CemaNeige = FALSE) + , + expected = PrepGR(ObsDF = as_tibble(BasinObs), HydroModel = "GR4J", CemaNeige = FALSE), + ) +})