From b9a36d46bac8c2fedc71b24a86bc4c82f82e0318 Mon Sep 17 00:00:00 2001 From: Dorchies David <david.dorchies@inrae.fr> Date: Mon, 25 Jul 2022 11:59:15 +0200 Subject: [PATCH] fix(tests): remaining errors Refs #42 --- tests/testthat/test-CreateInputsCrit.R | 2 +- tests/testthat/test-RunModel.R | 21 +++++++++++++-------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/tests/testthat/test-CreateInputsCrit.R b/tests/testthat/test-CreateInputsCrit.R index 26f910f..f5b55d6 100644 --- a/tests/testthat/test-CreateInputsCrit.R +++ b/tests/testthat/test-CreateInputsCrit.R @@ -123,6 +123,6 @@ test_that("Ungauged node as Apriori node should throw an error", { Obs = Qobs[IndPeriod_Run,], AprioriIds = c("54057" = "54032", "54032" = "54001", "54001" = "54029"), transfo = "sqrt"), - regexp = "\"54001\" is an ungauged upstream node of the node \"540032\"" + regexp = "\"54001\" is an ungauged upstream node of the node \"54032\"" ) }) diff --git a/tests/testthat/test-RunModel.R b/tests/testthat/test-RunModel.R index f75b408..177afc9 100644 --- a/tests/testthat/test-RunModel.R +++ b/tests/testthat/test-RunModel.R @@ -49,14 +49,19 @@ test_that("RunModel.Supervisor with no regulation should returns same results as }) # Add 2 nodes to the network -griwrm2 <- rbind(griwrm, - data.frame( - id = c("R1", "R2"), - down = "54057", - length = 100, - area = NA, - model = NA - )) +nodes2 <- rbind(nodes, + data.frame( + gauge_id = c("R1", "R2"), + downstream_id = "54057", + distance_downstream = 100, + area = NA, + model = NA + )) +griwrm2 <- CreateGRiwrm(nodes2, + list(id = "gauge_id", + down = "downstream_id", + length = "distance_downstream")) + # Add Qobs for the 2 new nodes and create InputsModel Qobs2 <- cbind(Qobs, matrix(data = rep(0, 2*nrow(Qobs)), ncol = 2)) colnames(Qobs2) <- c(colnames(Qobs2)[1:6], "R1", "R2") -- GitLab