aboutsummaryrefslogtreecommitdiffstats
path: root/src/testcases/org/apache/poi/ss/formula/functions
diff options
context:
space:
mode:
authorYegor Kozlov <yegor@apache.org>2017-12-30 13:11:56 +0000
committerYegor Kozlov <yegor@apache.org>2017-12-30 13:11:56 +0000
commit176b557f0de7c23cbb14540bb716d0161d1b89f4 (patch)
tree74906612a094f69d804d6bb7ca6d0faf17fee781 /src/testcases/org/apache/poi/ss/formula/functions
parent9365c5caa33c7c40617ea059c8365782deb11c13 (diff)
downloadpoi-176b557f0de7c23cbb14540bb716d0161d1b89f4.tar.gz
poi-176b557f0de7c23cbb14540bb716d0161d1b89f4.zip
Bugzilla 61116: Formula evaluation fails when using matrix addition within index function call
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1819596 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org/apache/poi/ss/formula/functions')
-rw-r--r--src/testcases/org/apache/poi/ss/formula/functions/TestIndex.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/testcases/org/apache/poi/ss/formula/functions/TestIndex.java b/src/testcases/org/apache/poi/ss/formula/functions/TestIndex.java
index b0b5927eea..c4ea7ed6b0 100644
--- a/src/testcases/org/apache/poi/ss/formula/functions/TestIndex.java
+++ b/src/testcases/org/apache/poi/ss/formula/functions/TestIndex.java
@@ -34,6 +34,7 @@ import org.apache.poi.ss.formula.eval.ValueEval;
import org.apache.poi.ss.formula.WorkbookEvaluator;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.util.CellRangeAddress;
+import org.apache.poi.ss.util.CellReference;
/**
* Tests for the INDEX() function.</p>
@@ -182,6 +183,20 @@ public final class TestIndex extends TestCase {
assertEquals(20.0, ex1cell3.getNumericCellValue());
}
+ public void test61116(){
+ Workbook workbook = HSSFTestDataSamples.openSampleWorkbook("61116.xls");
+ FormulaEvaluator evaluator = workbook.getCreationHelper().createFormulaEvaluator();
+ Sheet sheet = workbook.getSheet("sample2");
+
+ Row row = sheet.getRow(1);
+ assertEquals(3.0, evaluator.evaluate(row.getCell(1)).getNumberValue());
+ assertEquals(3.0, evaluator.evaluate(row.getCell(2)).getNumberValue());
+
+ row = sheet.getRow(2);
+ assertEquals(5.0, evaluator.evaluate(row.getCell(1)).getNumberValue());
+ assertEquals(5.0, evaluator.evaluate(row.getCell(2)).getNumberValue());
+ }
+
/**
* If both the Row_num and Column_num arguments are used,
* INDEX returns the value in the cell at the intersection of Row_num and Column_num