]> source.dussan.org Git - poi.git/commitdiff
Tweak test to run forward and back
authorNick Burch <nick@apache.org>
Thu, 10 Jul 2008 22:22:24 +0000 (22:22 +0000)
committerNick Burch <nick@apache.org>
Thu, 10 Jul 2008 22:22:24 +0000 (22:22 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@675785 13f79535-47bb-0310-9956-ffa450edef68

src/testcases/org/apache/poi/hssf/usermodel/TestFormulaEvaluatorBugs.java

index e6a133ad71082a8ad6e70284eec2a99486f7770c..318fcd2bf6262923c0ae0c58f24ab0d9c4364809 100644 (file)
@@ -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;