summaryrefslogtreecommitdiffstats
path: root/poi
diff options
context:
space:
mode:
authorPJ Fanning <fanningpj@apache.org>2021-12-05 18:54:58 +0000
committerPJ Fanning <fanningpj@apache.org>2021-12-05 18:54:58 +0000
commitc390436c9a1821bb51d2dd125d4b521e06726606 (patch)
treeb5b60b619c38a2cf89fbd8572a10ba6533495700 /poi
parenta60f552c5908dfaad31cfc0db6ef82690dcd5b96 (diff)
downloadpoi-c390436c9a1821bb51d2dd125d4b521e06726606.tar.gz
poi-c390436c9a1821bb51d2dd125d4b521e06726606.zip
fix broken xlookup test
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1895602 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi')
-rw-r--r--poi/src/main/java/org/apache/poi/ss/formula/functions/LookupUtils.java5
-rw-r--r--poi/src/test/java/org/apache/poi/ss/formula/atp/TestXLookupFunction.java3
2 files changed, 5 insertions, 3 deletions
diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/LookupUtils.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/LookupUtils.java
index 43ad217a5b..04ec1004b3 100644
--- a/poi/src/main/java/org/apache/poi/ss/formula/functions/LookupUtils.java
+++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/LookupUtils.java
@@ -760,7 +760,10 @@ public final class LookupUtils {
break;
}
if (result.isTypeMismatch()) {
- handleMidValueTypeMismatch(lookupComparer, vector, bsi, i, reverse);
+ int newIdx = handleMidValueTypeMismatch(lookupComparer, vector, bsi, i, reverse);
+ if (newIdx >= 0) {
+ return newIdx;
+ }
} else if (reverse) {
bsi.narrowSearch(i, result.isGreaterThan());
} else {
diff --git a/poi/src/test/java/org/apache/poi/ss/formula/atp/TestXLookupFunction.java b/poi/src/test/java/org/apache/poi/ss/formula/atp/TestXLookupFunction.java
index ab66de7c5e..0f03e35eef 100644
--- a/poi/src/test/java/org/apache/poi/ss/formula/atp/TestXLookupFunction.java
+++ b/poi/src/test/java/org/apache/poi/ss/formula/atp/TestXLookupFunction.java
@@ -127,8 +127,7 @@ public class TestXLookupFunction {
HSSFFormulaEvaluator fe = new HSSFFormulaEvaluator(wb);
HSSFCell cell = wb.getSheetAt(0).getRow(1).createCell(6);
assertDouble(fe, cell, "XLOOKUP(E2,C2:C7,B2:B7,0,1,-2)", 0.37);
- //TODO next assertion is not working and needs investigation
- //assertDouble(fe, cell, "XLOOKUP(9700,C2:C7,B2:B7,0,0,-2)", 0.1);
+ assertDouble(fe, cell, "XLOOKUP(9700,C2:C7,B2:B7,0,0,-2)", 0.1);
assertDouble(fe, cell, "XLOOKUP(39474,C2:C7,B2:B7,0,0,-2)", 0);
}
}