Add unit test showing that bug #51024 is incorrect

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1090293 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nick Burch 2011-04-08 15:23:18 +00:00
parent b642f8952e
commit 3cc63312ae

View File

@ -2075,4 +2075,34 @@ if(1==2) {
assertEquals("SECOND(A1)", s.getRow(7).getCell(0).getCellFormula());
assertEquals(54.0+24.0-60, s.getRow(7).getCell(0).getNumericCellValue());
}
/**
* HLookup and VLookup with optional arguments
*/
public void test51024() throws Exception {
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet s = wb.createSheet();
HSSFRow r1 = s.createRow(0);
HSSFRow r2 = s.createRow(1);
r1.createCell(0).setCellValue("v A1");
r2.createCell(0).setCellValue("v A2");
r1.createCell(1).setCellValue("v B1");
HSSFCell c = r1.createCell(4);
HSSFFormulaEvaluator eval = new HSSFFormulaEvaluator(wb);
c.setCellFormula("VLOOKUP(\"v A1\", A1:B2, 1)");
assertEquals("v A1", eval.evaluate(c).getStringValue());
c.setCellFormula("VLOOKUP(\"v A1\", A1:B2, 1, 1)");
assertEquals("v A1", eval.evaluate(c).getStringValue());
c.setCellFormula("HLOOKUP(\"v A1\", A1:B2, 1)");
assertEquals("v A1", eval.evaluate(c).getStringValue());
c.setCellFormula("HLOOKUP(\"v A1\", A1:B2, 1, 1)");
assertEquals("v A1", eval.evaluate(c).getStringValue());
}
}