From 19882d69e9abd87013f50330be3d41384276cf06 Mon Sep 17 00:00:00 2001 From: Nick Burch Date: Thu, 10 Jul 2008 22:22:24 +0000 Subject: [PATCH] Tweak test to run forward and back git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@675785 13f79535-47bb-0310-9956-ffa450edef68 --- .../usermodel/TestFormulaEvaluatorBugs.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestFormulaEvaluatorBugs.java b/src/testcases/org/apache/poi/hssf/usermodel/TestFormulaEvaluatorBugs.java index e6a133ad7..318fcd2bf 100644 --- a/src/testcases/org/apache/poi/hssf/usermodel/TestFormulaEvaluatorBugs.java +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestFormulaEvaluatorBugs.java @@ -297,7 +297,8 @@ public final class TestFormulaEvaluatorBugs extends TestCase { /** * 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 { HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("45376.xls"); @@ -309,7 +310,7 @@ public final class TestFormulaEvaluatorBugs extends TestCase { int firstCol = 4; int lastCol = 14; long[] timings = new long[lastCol-firstCol+1]; - long[] stimings = new long[lastCol-firstCol+1]; + long[] rtimings = new long[lastCol-firstCol+1]; long then, now; @@ -327,6 +328,19 @@ public final class TestFormulaEvaluatorBugs extends TestCase { timings[i-firstCol] = (then-now); 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 long avg = 0;