]> source.dussan.org Git - poi.git/commitdiff
Add disabled test for bug #45376
authorNick Burch <nick@apache.org>
Thu, 10 Jul 2008 22:14:25 +0000 (22:14 +0000)
committerNick Burch <nick@apache.org>
Thu, 10 Jul 2008 22:14:25 +0000 (22:14 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@675783 13f79535-47bb-0310-9956-ffa450edef68

src/testcases/org/apache/poi/hssf/data/45376.xls [new file with mode: 0644]
src/testcases/org/apache/poi/hssf/usermodel/TestFormulaEvaluatorBugs.java

diff --git a/src/testcases/org/apache/poi/hssf/data/45376.xls b/src/testcases/org/apache/poi/hssf/data/45376.xls
new file mode 100644 (file)
index 0000000..74602fd
Binary files /dev/null and b/src/testcases/org/apache/poi/hssf/data/45376.xls differ
index 349cfa8a8504b4d4cb7910eae054b3a6dc11f2f1..e6a133ad71082a8ad6e70284eec2a99486f7770c 100644 (file)
@@ -294,4 +294,56 @@ public final class TestFormulaEvaluatorBugs extends TestCase {
                        throw e;
                }
        }
+       
+       /**
+        * Apparently, each subsequent call takes longer, which is very
+        *  odd
+        */
+       public void DISABLEDtestSlowEvaluate45376() throws Exception {
+               HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("45376.xls");
+               
+               final String SHEET_NAME = "Eingabe";
+        final int row = 6;
+        final HSSFSheet sheet = wb.getSheet(SHEET_NAME);
+        
+        int firstCol = 4;
+        int lastCol = 14;
+        long[] timings = new long[lastCol-firstCol+1];
+        long[] stimings = new long[lastCol-firstCol+1];
+        
+        long then, now;
+
+        final HSSFRow excelRow = sheet.getRow(row);
+        for(int i = firstCol; i <= lastCol; 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();
+             timings[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;
+        for(int i=0; i<timings.length; i++) {
+               avg += timings[i];
+        }
+        avg = (long)( ((double)avg) / timings.length );
+        
+        // Warn if any took more then 1.5 the average
+        // TODO - replace with assert or similar
+        for(int i=0; i<timings.length; i++) {
+               if(timings[i] > 1.5*avg) {
+                       System.err.println("Doing col " + (i+firstCol) + 
+                                       " took " + timings[i] + "ms, vs avg " + 
+                                       avg + "ms"
+                       );
+               }
+        }
+       }
 }
\ No newline at end of file