aboutsummaryrefslogtreecommitdiffstats
path: root/poi
diff options
context:
space:
mode:
authorPJ Fanning <fanningpj@apache.org>2021-12-06 13:05:08 +0000
committerPJ Fanning <fanningpj@apache.org>2021-12-06 13:05:08 +0000
commit6290a5ed24a5506bafc0281729bfd438b7bfb144 (patch)
tree06d170f66ecf4b83bb1c940b46e302eb5e53b4aa /poi
parentc84888490fbc1bfb3b805e3b831dcfc836fa0238 (diff)
downloadpoi-6290a5ed24a5506bafc0281729bfd438b7bfb144.tar.gz
poi-6290a5ed24a5506bafc0281729bfd438b7bfb144.zip
add xmatch test
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1895622 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi')
-rw-r--r--poi/src/test/java/org/apache/poi/ss/formula/atp/TestXMatchFunction.java27
1 files changed, 27 insertions, 0 deletions
diff --git a/poi/src/test/java/org/apache/poi/ss/formula/atp/TestXMatchFunction.java b/poi/src/test/java/org/apache/poi/ss/formula/atp/TestXMatchFunction.java
index e656d2782d..61e089bc78 100644
--- a/poi/src/test/java/org/apache/poi/ss/formula/atp/TestXMatchFunction.java
+++ b/poi/src/test/java/org/apache/poi/ss/formula/atp/TestXMatchFunction.java
@@ -73,6 +73,15 @@ public class TestXMatchFunction {
}
@Test
+ void testMicrosoftExample3() throws IOException {
+ try (HSSFWorkbook wb = initWorkbook3()) {
+ HSSFFormulaEvaluator fe = new HSSFFormulaEvaluator(wb);
+ HSSFCell cell = wb.getSheetAt(0).getRow(2).createCell(3);
+ assertDouble(fe, cell, "INDEX(C6:E12,XMATCH(B3,B6:B12),XMATCH(C3,C5:E5))", 8492);
+ }
+ }
+
+ @Test
void testMicrosoftExample4() throws IOException {
try (HSSFWorkbook wb = new HSSFWorkbook()) {
HSSFFormulaEvaluator fe = new HSSFFormulaEvaluator(wb);
@@ -110,4 +119,22 @@ public class TestXMatchFunction {
return wb;
}
+ private HSSFWorkbook initWorkbook3() {
+ HSSFWorkbook wb = new HSSFWorkbook();
+ HSSFSheet sheet = wb.createSheet();
+ addRow(sheet, 0);
+ addRow(sheet, 1, null, "Sales Rep", "Month", "Total");
+ addRow(sheet, 2, null, "Andrew Cencini", "Feb");
+ addRow(sheet, 3);
+ addRow(sheet, 4, null, "Sales Rep", "Jan", "Feb", "Mar");
+ addRow(sheet, 5, null, "Michael Neipper", 3174, 6804, 4713);
+ addRow(sheet, 6, null, "Jan Kotas", 1656, 8643, 3445);
+ addRow(sheet, 7, null, "Nancy Freehafer", 2706, 2310, 6606);
+ addRow(sheet, 8, null, "Andrew Cencini", 4930, 8492, 4474);
+ addRow(sheet, 9, null, "Anne Hellung-Larsen", 6394, 9846, 4368);
+ addRow(sheet, 10, null, "Nancy Freehafer", 2539, 8996, 4084);
+ addRow(sheet, 11, null, "Mariya Sergienko", 4468, 5206, 7343);
+ return wb;
+ }
+
}