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 June 1, 2025, 3:11 p.m.