tests/testthat/helper-expect.R

# PsychroLib (version 2.5.0) (https://github.com/psychrometrics/psychrolib).
# Copyright (c) 2018-2020 The PsychroLib Contributors. Licensed under the MIT License.

# Behave like pytest.approx when used with rel option
expect_equal_rel <- function (object, expected, rel) {
    expect_equal(object, expected, scale = abs(expected), tolerance = rel)
}

# Behave like pytest.approx when used with abs option
expect_equal_abs <- function (object, expected, abs) {
    expect_equal(object, expected, scale = 1.0, tolerance = abs)
}

expect_equivalent_rel <- function (object, expected, rel) {
    expect_equivalent(object, expected, scale = abs(expected), tolerance = rel)
}

expect_equivalent_abs <- function (object, expected, abs) {
    expect_equivalent(object, expected, scale = 1.0, tolerance = abs)
}

Try the psychrolib package in your browser

Any scripts or data that you put into this service are public.

psychrolib documentation built on May 29, 2021, 9:11 a.m.