I got an error when trying to use expect_equal() even though the equivalent all.equal() gave correct result.
expect_equal(
my_function(binary_actual, predicted),
target = 0.4861996,
tol = 10e-8
)
# FALSE
all.equal(my_function(binary_actual, predicted),
target = 0.4861996,
tolerance = 10e-8)
# TRUE
It seems that the argument tol is not used by expect_equal():
expect_equal <- function(current, target, tol = sqrt(.Machine$double.eps), ...){
check <- all.equal(current, target,...)
[truncated]
}
I think the correct way should be:
expect_equal <- function(current, target, tol = sqrt(.Machine$double.eps), ...){
check <- all.equal(current, target, tolerance = tol, ...)
[truncated]
}
I got an error when trying to use
expect_equal()even though the equivalentall.equal()gave correct result.expect_equal( my_function(binary_actual, predicted), target = 0.4861996, tol = 10e-8 ) # FALSE all.equal(my_function(binary_actual, predicted), target = 0.4861996, tolerance = 10e-8) # TRUEIt seems that the argument
tolis not used byexpect_equal():I think the correct way should be: