Lines 404-410
Link Here
|
404 |
|
404 |
|
405 |
} |
405 |
} |
406 |
|
406 |
|
407 |
public static void main(String [] args) { |
407 |
// bug 38396 : Formula with exponential numbers not parsed correctly. |
|
|
408 |
public void testExponentialParsing() { |
409 |
FormulaParser fp = new FormulaParser("13E21/2", null); |
410 |
fp.parse(); |
411 |
Ptg[] ptgs = fp.getRPNPtg(); |
412 |
assertTrue("three tokens expected, got "+ptgs.length,ptgs.length == 3); |
413 |
assertTrue("NumberPtg",(ptgs[0] instanceof NumberPtg)); |
414 |
assertTrue("IntPtg",(ptgs[1] instanceof IntPtg)); |
415 |
assertTrue("DividePtg",(ptgs[2] instanceof DividePtg)); |
416 |
} |
417 |
public void testExponentialInSheet() { |
418 |
HSSFWorkbook wb = new HSSFWorkbook(); |
419 |
|
420 |
wb.createSheet("Cash_Flow");; |
421 |
|
422 |
HSSFSheet sheet = wb.createSheet("Test"); |
423 |
HSSFRow row = sheet.createRow(0); |
424 |
HSSFCell cell; |
425 |
|
426 |
cell = row.createCell((short)0); |
427 |
cell.setCellFormula("13E21/3"); |
428 |
String formula = cell.getCellFormula(); |
429 |
assertEquals("Exponential formula string", "1.3E22/3", formula); |
430 |
} |
431 |
|
432 |
public static void main(String [] args) { |
408 |
System.out.println("Testing org.apache.poi.hssf.record.formula.FormulaParser"); |
433 |
System.out.println("Testing org.apache.poi.hssf.record.formula.FormulaParser"); |
409 |
junit.textui.TestRunner.run(TestFormulaParser.class); |
434 |
junit.textui.TestRunner.run(TestFormulaParser.class); |
410 |
} |
435 |
} |