use of org.apache.poi.ss.formula.eval.NumberEval 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());
}
use of org.apache.poi.ss.formula.eval.NumberEval in project poi by apache.
the class TestTrunc method testTruncWithDecimalNumber.
public void testTruncWithDecimalNumber() {
ValueEval[] args = { new NumberEval(2.612777), new NumberEval(3) };
@SuppressWarnings("static-access") ValueEval result = F.TRUNC.evaluate(args, -1, (short) -1);
assertEquals("TRUNC", (new NumberEval(2.612d)).getNumberValue(), ((NumberEval) result).getNumberValue());
}
use of org.apache.poi.ss.formula.eval.NumberEval in project poi by apache.
the class TestXYNumericFunction 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.REF_INVALID);
confirmError(areaEvalY, areaEvalX, ErrorEval.NULL_INTERSECTION);
}
use of org.apache.poi.ss.formula.eval.NumberEval in project poi by apache.
the class TestPercentile method testBlanks.
public void testBlanks() {
ValueEval[] values = { new NumberEval(210.128), new NumberEval(65.2182), new NumberEval(32.231), BlankEval.instance, new NumberEval(45.32) };
ValueEval percentile = new NumberEval(0.95);
confirmPercentile(percentile, values, 188.39153);
}
use of org.apache.poi.ss.formula.eval.NumberEval in project poi by apache.
the class TestPercentile method testErrors.
//here we test where there are errors as part of inputs
public void testErrors() {
ValueEval[] values = { new NumberEval(1), ErrorEval.NAME_INVALID, new NumberEval(3), ErrorEval.DIV_ZERO };
ValueEval percentile = new NumberEval(0.95);
confirmPercentile(percentile, values, ErrorEval.NAME_INVALID);
}
Aggregations