use of org.apache.poi.ss.formula.eval.NumberEval in project poi by apache.
the class TestCellCacheEntry method testBasic.
public void testBasic() {
CellCacheEntry pcce = new PlainValueCellCacheEntry(new NumberEval(42.0));
ValueEval ve = pcce.getValue();
assertEquals(42, ((NumberEval) ve).getNumberValue(), 0.0);
FormulaCellCacheEntry fcce = new FormulaCellCacheEntry();
fcce.updateFormulaResult(new NumberEval(10.0), CellCacheEntry.EMPTY_ARRAY, null);
ve = fcce.getValue();
assertEquals(10, ((NumberEval) ve).getNumberValue(), 0.0);
}
use of org.apache.poi.ss.formula.eval.NumberEval in project poi by apache.
the class TestPercentile method testUnusualArgs.
public void testUnusualArgs() {
ValueEval[] values = { new NumberEval(1), new NumberEval(2), BoolEval.TRUE, BoolEval.FALSE };
ValueEval percentile = new NumberEval(0.95);
confirmPercentile(percentile, values, 1.95);
}
use of org.apache.poi.ss.formula.eval.NumberEval in project poi by apache.
the class TestPercentile method testBasic.
public void testBasic() {
ValueEval[] values = { new NumberEval(210.128), new NumberEval(65.2182), new NumberEval(32.231), new NumberEval(12.123), new NumberEval(45.32) };
ValueEval percentile = new NumberEval(0.95);
confirmPercentile(percentile, values, 181.14604);
}
use of org.apache.poi.ss.formula.eval.NumberEval in project poi by apache.
the class TestPercentile method testErrors2.
//here we test where there are errors as part of inputs
public void testErrors2() {
ValueEval[] values = { new NumberEval(1), new NumberEval(2), new NumberEval(3), ErrorEval.DIV_ZERO };
ValueEval percentile = new NumberEval(0.95);
confirmPercentile(percentile, values, ErrorEval.DIV_ZERO);
}
use of org.apache.poi.ss.formula.eval.NumberEval in project poi by apache.
the class TestPercentile method testUnusualArgs2.
//percentile has to be between 0 and 1 - here we test less than zero
public void testUnusualArgs2() {
ValueEval[] values = { new NumberEval(1), new NumberEval(2) };
ValueEval percentile = new NumberEval(-0.1);
confirmPercentile(percentile, values, ErrorEval.NUM_ERROR);
}
Aggregations