Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
HYCAR-Hydro
airGR
Commits
bd42c74a
Commit
bd42c74a
authored
Jun 24, 2021
by
Dorchies David
Browse files
fix(CreateInputsCrit_DeLavenne): inapropriate error message for wrong length of parameter AprParam
Refs #"111
parent
c056397c
Changes
2
Hide whitespace changes
Inline
Side-by-side
R/CreateInputsCrit_DeLavenne.R
View file @
bd42c74a
...
...
@@ -26,6 +26,10 @@ CreateInputsCrit_DeLavenne <- function(FUN_CRIT = ErrorCrit_KGE,
if
(
!
is.null
(
epsilon
)
&&
!
is.numeric
(
epsilon
))
{
stop
(
"'epsilon' must be numeric"
)
}
if
(
!
is.numeric
(
AprParamR
)
||
length
(
AprParamR
)
!=
RunOptions
$
FeatFUN_MOD
$
NbParam
)
{
stop
(
"'AprParamR' must be a numeric vector of length "
,
RunOptions
$
FeatFUN_MOD
$
NbParam
)
}
FUN_TRANSFO
<-
.FunTransfo
(
RunOptions
$
FeatFUN_MOD
)
...
...
tests/testthat/test-CreateInputsCrit_DeLavenne.R
View file @
bd42c74a
...
...
@@ -38,3 +38,14 @@ test_that("should return KGE*(1-k)+k with parameters matching a priori parameter
ErrorCrit
(
IC_DL
,
OutputsModel
)
$
CritValue
)
})
test_that
(
"should return proper error if mismatch number of parameters"
,
{
expect_error
(
CreateInputsCrit_DeLavenne
(
FUN_CRIT
=
ErrorCrit_KGE
,
InputsModel
=
InputsModel
,
RunOptions
=
RunOptions
,
Obs
=
BasinObs
$
Qmm
[
Ind_Run
],
AprParamR
=
Param
[
-1
],
k
=
k
),
regex
=
"'AprParamR' must be a numeric vector of length 4"
)
})
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment