expect_almost_equal.Rd
Tests the approximate equality of 2 objects. Useful for running tests.
expect_almost_equal(x, y, tolExpect = 0.001)
first object.
second object.
tolerance, default is 0.001.
This function works with the expect_that
function from package
testhat
to test equality between 2 objects with a given
tolerance. It is used particularly for testing functions output. See the
CF examples in the Examples folder.
expect_that
,testthat
x <- 1.1
y <- 1.5
expect_almost_equal(x, y, 1) # passes
#> <expectation_success/expectation/condition>
#> As expected
## expect_almost_equal(x, y, 0.3) # fails