git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1716811 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Javen O'Neal 2015-11-27 09:45:53 +00:00
parent effe60c6af
commit 109e8b4fb3
1 changed files with 5 additions and 0 deletions

View File

@ -56,6 +56,11 @@ public abstract class BaseTestBugzillaIssues {
_testDataProvider = testDataProvider; _testDataProvider = testDataProvider;
} }
/**
* Unlike org.junit.Assert.assertEquals(double expected, double actual, double delta),
* where delta is an absolute error value, this function's factor is a relative error,
* so it's easier to express "actual is within 5% of expected".
*/
public static void assertAlmostEquals(double expected, double actual, float factor) { public static void assertAlmostEquals(double expected, double actual, float factor) {
double diff = Math.abs(expected - actual); double diff = Math.abs(expected - actual);
double fuzz = expected * factor; double fuzz = expected * factor;