add broken test (xlookup)

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1895623 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
PJ Fanning 2021-12-06 13:39:57 +00:00
parent 6290a5ed24
commit 811d4faf7b
1 changed files with 29 additions and 0 deletions

View File

@ -142,6 +142,18 @@ public class TestXLookupFunction {
}
}
@Test
void testMicrosoftExample6() throws IOException {
try (HSSFWorkbook wb = initWorkbook6()) {
HSSFFormulaEvaluator fe = new HSSFFormulaEvaluator(wb);
HSSFCell cell = wb.getSheetAt(0).getRow(2).createCell(3);
assertDouble(fe, cell, "XLOOKUP(B3,B6:B10,E6:E10)", 75.28);
assertDouble(fe, cell, "XLOOKUP(C3,B6:B10,E6:E10)", 17.25);
//TODO next to fix FormulaParser to get this to work
//assertDouble(fe, cell, "SUM(XLOOKUP(B3,B6:B10,E6:E10):XLOOKUP(C3,B6:B10,E6:E10))", 110.70);
}
}
private HSSFWorkbook initWorkbook1() {
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet = wb.createSheet();
@ -240,4 +252,21 @@ public class TestXLookupFunction {
return wb;
}
private HSSFWorkbook initWorkbook6() {
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet = wb.createSheet();
addRow(sheet, 0);
addRow(sheet, 1, null, "Start", "End", "Total");
addRow(sheet, 2, null, "Grape", "Banana");
addRow(sheet, 3, null, "United States", "US", "+1");
addRow(sheet, 4);
addRow(sheet, 5, null, "Product", "Qty", "Price", "Total");
addRow(sheet, 6, null, "Apple", 23, 0.52, 11.90);
addRow(sheet, 7, null, "Grape", 98, 0.77, 75.28);
addRow(sheet, 8, null, "Pear", 75, 0.24, 18.16);
addRow(sheet, 9, null, "Banana", 95, 0.18, 17.25);
addRow(sheet, 10, null, "Cherry", 42, 0.16, 6.80);
return wb;
}
}