Search in sources :

Example 11 with I_MatchPredicate

use of org.apache.poi.ss.formula.functions.CountUtils.I_MatchPredicate in project poi by apache.

the class TestCountFuncs method testWildCards.

public void testWildCards() {
    I_MatchPredicate mp;
    mp = createCriteriaPredicate(new StringEval("a*b"));
    confirmPredicate(false, mp, "abc");
    confirmPredicate(true, mp, "ab");
    confirmPredicate(true, mp, "axxb");
    confirmPredicate(false, mp, "xab");
    mp = createCriteriaPredicate(new StringEval("a?b"));
    confirmPredicate(false, mp, "abc");
    confirmPredicate(false, mp, "ab");
    confirmPredicate(false, mp, "axxb");
    confirmPredicate(false, mp, "xab");
    confirmPredicate(true, mp, "axb");
    mp = createCriteriaPredicate(new StringEval("a~?"));
    confirmPredicate(false, mp, "a~a");
    confirmPredicate(false, mp, "a~?");
    confirmPredicate(true, mp, "a?");
    mp = createCriteriaPredicate(new StringEval("~*a"));
    confirmPredicate(false, mp, "~aa");
    confirmPredicate(false, mp, "~*a");
    confirmPredicate(true, mp, "*a");
    mp = createCriteriaPredicate(new StringEval("12?12"));
    confirmPredicate(false, mp, 12812);
    confirmPredicate(true, mp, "12812");
    confirmPredicate(false, mp, "128812");
}
Also used : I_MatchPredicate(org.apache.poi.ss.formula.functions.CountUtils.I_MatchPredicate) StringEval(org.apache.poi.ss.formula.eval.StringEval)

Aggregations

I_MatchPredicate (org.apache.poi.ss.formula.functions.CountUtils.I_MatchPredicate)11 StringEval (org.apache.poi.ss.formula.eval.StringEval)7 NumberEval (org.apache.poi.ss.formula.eval.NumberEval)5 AreaEval (org.apache.poi.ss.formula.eval.AreaEval)4 ValueEval (org.apache.poi.ss.formula.eval.ValueEval)2 AssertionFailedError (junit.framework.AssertionFailedError)1 EvaluationException (org.apache.poi.ss.formula.eval.EvaluationException)1