mirror of https://github.com/apache/poi.git
Add disabled test for bug #45376
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@675783 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
21d6638529
commit
fddba3da89
Binary file not shown.
|
@ -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"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue