Tweak test to run forward and back

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@675785 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nick Burch 2008-07-10 22:22:24 +00:00
parent 3ee8895f5f
commit 19882d69e9

View File

@ -297,7 +297,8 @@ public final class TestFormulaEvaluatorBugs extends TestCase {
/** /**
* Apparently, each subsequent call takes longer, which is very * Apparently, each subsequent call takes longer, which is very
* odd * odd.
* We think it's because the formulas are recursive and crazy
*/ */
public void DISABLEDtestSlowEvaluate45376() throws Exception { public void DISABLEDtestSlowEvaluate45376() throws Exception {
HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("45376.xls"); HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("45376.xls");
@ -309,7 +310,7 @@ public final class TestFormulaEvaluatorBugs extends TestCase {
int firstCol = 4; int firstCol = 4;
int lastCol = 14; int lastCol = 14;
long[] timings = new long[lastCol-firstCol+1]; long[] timings = new long[lastCol-firstCol+1];
long[] stimings = new long[lastCol-firstCol+1]; long[] rtimings = new long[lastCol-firstCol+1];
long then, now; long then, now;
@ -327,6 +328,19 @@ public final class TestFormulaEvaluatorBugs extends TestCase {
timings[i-firstCol] = (then-now); timings[i-firstCol] = (then-now);
System.err.println("Col " + i + " took " + (then-now) + "ms"); System.err.println("Col " + i + " took " + (then-now) + "ms");
} }
for(int i = lastCol; i >= firstCol; i--) {
final HSSFCell excelCell = excelRow.getCell(i);
final HSSFFormulaEvaluator evaluator = new
HSSFFormulaEvaluator(sheet, wb);
evaluator.setCurrentRow(excelRow);
now = System.currentTimeMillis();
evaluator.evaluate(excelCell);
then = System.currentTimeMillis();
rtimings[i-firstCol] = (then-now);
System.err.println("Col " + i + " took " + (then-now) + "ms");
}
// The timings for each should be about the same // The timings for each should be about the same
long avg = 0; long avg = 0;