use of org.apache.poi.ss.formula.eval.ValueEval in project poi by apache.
the class TestEvaluationCache method confirmEvaluate.
private static void confirmEvaluate(MySheet ms, String cellRefText, double expectedValue) {
ValueEval v = ms.evaluateCell(cellRefText);
assertEquals(NumberEval.class, v.getClass());
assertEquals(expectedValue, ((NumberEval) v).getNumberValue(), 0.0);
}
use of org.apache.poi.ss.formula.eval.ValueEval in project poi by apache.
the class TestWorkbookEvaluator method testMemFunc.
/**
* Make sure that the evaluator can directly handle tAttrSum (instead of relying on re-parsing
* the whole formula which converts tAttrSum to tFuncVar("SUM") )
*/
@Test
public void testMemFunc() {
Ptg[] ptgs = { new IntPtg(42), AttrPtg.SUM };
ValueEval result = evaluateFormula(ptgs);
assertEquals(42, ((NumberEval) result).getNumberValue(), 0.0);
}
use of org.apache.poi.ss.formula.eval.ValueEval 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.ValueEval 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);
}
use of org.apache.poi.ss.formula.eval.ValueEval in project poi by apache.
the class TestPercentile method testUnusualArgs3.
//percentile has to be between 0 and 1 - here we test more than 1
public void testUnusualArgs3() {
ValueEval[] values = { new NumberEval(1), new NumberEval(2) };
ValueEval percentile = new NumberEval(1.1);
confirmPercentile(percentile, values, ErrorEval.NUM_ERROR);
}
Aggregations