use of org.apache.poi.ss.formula.eval.ValueEval in project poi by apache.
the class TestOct2Dec method confirmValueError.
private static void confirmValueError(String msg, String number1, ErrorEval numError) {
ValueEval result = invokeValue(number1);
assertEquals(ErrorEval.class, result.getClass());
assertEquals(msg, numError, result);
}
use of org.apache.poi.ss.formula.eval.ValueEval in project poi by apache.
the class TestOct2Dec method confirmValue.
private static void confirmValue(String msg, String number1, String expected) {
ValueEval result = invokeValue(number1);
assertEquals(NumberEval.class, result.getClass());
assertEquals(msg, expected, ((NumberEval) result).getStringValue());
}
use of org.apache.poi.ss.formula.eval.ValueEval in project poi by apache.
the class TestMatch method testInvalidMatchType.
public void testInvalidMatchType() {
ValueEval[] values = { new NumberEval(4), new NumberEval(5), new NumberEval(10), new NumberEval(10), new NumberEval(25) };
AreaEval ae = EvalFactory.createAreaEval("A1:A5", values);
confirmInt(2, invokeMatch(new NumberEval(5), ae, MATCH_LARGEST_LTE));
assertEquals("Should return #REF! for invalid match type", ErrorEval.REF_INVALID, invokeMatch(new StringEval("Ben"), ae, MATCH_INVALID));
}
use of org.apache.poi.ss.formula.eval.ValueEval in project poi by apache.
the class TestMatch method testTildeString.
public void testTildeString() {
ValueEval[] values = { new StringEval("what?"), new StringEval("all*") };
AreaEval ae = EvalFactory.createAreaEval("A1:A2", values);
confirmInt(1, invokeMatch(new StringEval("what~?"), ae, MATCH_EXACT));
confirmInt(2, invokeMatch(new StringEval("all~*"), ae, MATCH_EXACT));
}
use of org.apache.poi.ss.formula.eval.ValueEval in project poi by apache.
the class TestTrunc method testNegative.
public void testNegative() {
ValueEval[] args = { new NumberEval(-8.9), new NumberEval(0) };
@SuppressWarnings("static-access") ValueEval result = F.TRUNC.evaluate(args, -1, (short) -1);
assertEquals("TRUNC", (new NumberEval(-8)).getNumberValue(), ((NumberEval) result).getNumberValue());
}
Aggregations