]> source.dussan.org Git - poi.git/commitdiff
fix broken xlookup test
authorPJ Fanning <fanningpj@apache.org>
Sun, 5 Dec 2021 18:54:58 +0000 (18:54 +0000)
committerPJ Fanning <fanningpj@apache.org>
Sun, 5 Dec 2021 18:54:58 +0000 (18:54 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1895602 13f79535-47bb-0310-9956-ffa450edef68

poi/src/main/java/org/apache/poi/ss/formula/functions/LookupUtils.java
poi/src/test/java/org/apache/poi/ss/formula/atp/TestXLookupFunction.java

index 43ad217a5b0bbd10acc44a615c63eb7d274c6c4e..04ec1004b365f669357def8ae9cadfb32fac2092 100644 (file)
@@ -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 {
index ab66de7c5e8256ed51d17a53cba1fd85b5ec4e77..0f03e35eefa43d8227665097e83e3a6365eac613 100644 (file)
@@ -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);
         }
     }