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:
Nick Burch 2008-07-10 22:14:25 +00:00
parent 927ed3a6ca
commit 3ee8895f5f
2 changed files with 52 additions and 0 deletions

Binary file not shown.

View 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"
);
}
}
}
}