use of org.apache.poi.ss.formula.eval.ValueEval in project poi by apache.
the class TestTrim method confirmTrim.
private void confirmTrim(ValueEval text, String expected) {
ValueEval result = invokeTrim(text);
assertEquals(StringEval.class, result.getClass());
assertEquals(expected, ((StringEval) result).getStringValue());
}
use of org.apache.poi.ss.formula.eval.ValueEval in project poi by apache.
the class TestTrunc method testTruncWithDecimalNumberOneArg.
public void testTruncWithDecimalNumberOneArg() {
ValueEval[] args = { new NumberEval(2.612777) };
ValueEval result = NumericFunction.TRUNC.evaluate(args, -1, (short) -1);
assertEquals("TRUNC", (new NumberEval(2d)).getNumberValue(), ((NumberEval) result).getNumberValue());
}
use of org.apache.poi.ss.formula.eval.ValueEval in project poi by apache.
the class TestQuotient method confirmValueError.
private static void confirmValueError(String msg, String numerator, String denominator, ErrorEval numError) {
ValueEval result = invokeValue(numerator, denominator);
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 TestSlope method testErrors.
public void testErrors() {
ValueEval[] xValues = { ErrorEval.REF_INVALID, new NumberEval(2) };
ValueEval areaEvalX = createAreaEval(xValues);
ValueEval[] yValues = { new NumberEval(2), ErrorEval.NULL_INTERSECTION };
ValueEval areaEvalY = createAreaEval(yValues);
ValueEval[] zValues = { // wrong size
new NumberEval(2) };
ValueEval areaEvalZ = createAreaEval(zValues);
// if either arg is an error, that error propagates
confirmError(ErrorEval.REF_INVALID, ErrorEval.NAME_INVALID, ErrorEval.REF_INVALID);
confirmError(areaEvalX, ErrorEval.NAME_INVALID, ErrorEval.NAME_INVALID);
confirmError(ErrorEval.NAME_INVALID, areaEvalX, ErrorEval.NAME_INVALID);
// array sizes must match
confirmError(areaEvalX, areaEvalZ, ErrorEval.NA);
confirmError(areaEvalZ, areaEvalY, ErrorEval.NA);
// any error in an array item propagates up
confirmError(areaEvalX, areaEvalX, ErrorEval.REF_INVALID);
// search for errors array by array, not pair by pair
confirmError(areaEvalX, areaEvalY, ErrorEval.NULL_INTERSECTION);
confirmError(areaEvalY, areaEvalX, ErrorEval.REF_INVALID);
}
use of org.apache.poi.ss.formula.eval.ValueEval in project poi by apache.
the class TestSlope method confirm.
private void confirm(Function function, ValueEval xArray, ValueEval yArray, double expected) {
ValueEval result = invoke(function, xArray, yArray);
assertEquals(NumberEval.class, result.getClass());
assertEquals(expected, ((NumberEval) result).getNumberValue(), 0);
}
Aggregations