tests/testthat/helper.R

# absolute value
max_MAE <- function(yobs, ysim, maxE = 0.005) {
    re <- abs(ysim - yobs) # /yobs
    # print(re)
    expect_lte(re, maxE)
}

# percentage
max_Bias <- function(yobs, ysim, maxE = 0.005) {
    re <- abs(ysim - yobs) / yobs
    # print(re)
    expect_lte(re, maxE)
}
rpkgs/hydroTools documentation built on Oct. 8, 2024, 7:47 p.m.