use of org.apache.poi.ss.formula.eval.ValueEval in project poi by apache.
the class TestSlope method testLargeArrays.
/**
* number of items in array is not limited to 30
*/
public void testLargeArrays() {
// [1,2,0,1,2,0,...,0,1]
ValueEval[] yValues = createMockNumberArray(100, 3);
// Changes first element to 2
yValues[0] = new NumberEval(2.0);
// [1,2,3,4,...,99,100]
ValueEval[] xValues = createMockNumberArray(100, 101);
confirm(SLOPE, createAreaEval(xValues), createAreaEval(yValues), -1.231527093596059);
// Excel 2010 gives -1.23152709359606
}
use of org.apache.poi.ss.formula.eval.ValueEval in project poi by apache.
the class TestSlope method confirmError.
private void confirmError(Function function, ValueEval xArray, ValueEval yArray, ErrorEval expectedError) {
ValueEval result = invoke(function, xArray, yArray);
assertEquals(ErrorEval.class, result.getClass());
assertEquals(expectedError.getErrorCode(), ((ErrorEval) result).getErrorCode());
}
use of org.apache.poi.ss.formula.eval.ValueEval in project poi by apache.
the class TestPmt method test3args.
@Test
public void test3args() {
ValueEval[] args = { new NumberEval(0.005), new NumberEval(24), new NumberEval(1000) };
ValueEval ev = invoke(args);
if (ev instanceof ErrorEval) {
ErrorEval err = (ErrorEval) ev;
if (err.getErrorCode() == FormulaError.VALUE.getCode()) {
fail("Identified bug 44691");
}
}
confirm(-44.3206, invokeNormal(args));
}
use of org.apache.poi.ss.formula.eval.ValueEval in project poi by apache.
the class TestPoisson method invokePoisson.
private static ValueEval invokePoisson(double x, double mean, boolean cumulative) {
ValueEval[] valueEvals = new ValueEval[3];
valueEvals[0] = new NumberEval(x);
valueEvals[1] = new NumberEval(mean);
valueEvals[2] = BoolEval.valueOf(cumulative);
return NumericFunction.POISSON.evaluate(valueEvals, -1, -1);
}
use of org.apache.poi.ss.formula.eval.ValueEval in project poi by apache.
the class TestQuotient method confirmValue.
private static void confirmValue(String msg, String numerator, String denominator, String expected) {
ValueEval result = invokeValue(numerator, denominator);
assertEquals(NumberEval.class, result.getClass());
assertEquals(msg, expected, ((NumberEval) result).getStringValue());
}
Aggregations