julian-urbano / ircor

Correlation Coefficients for Information Retrieval
Other
6 stars 0 forks source link

Test tolerance #6

Open julian-urbano opened 2 years ago

julian-urbano commented 2 years ago

Testthat's expect_equal can work with a tolerance, but whether this tolerance is absolute or relative actually depends on the version (waldo:::num_equal in 3e, testthat:::compare.numeric in 2e), possibly its size compared to the target value, or the specific path taken by testthat:::compare.numeric and all.equal.

Such dependence on the magnitude of the target value may lead to false positives in our case, so it's probably a good idea to write an expect_ variant or any other solution that always uses absolute tolerances, such as setting scale = 1 to end up in all.equal.