use of org.apache.poi.ss.formula.eval.ValueEval in project poi by apache.
the class TestEOMonth method testRefEvalStartDate.
@Test
public void testRefEvalStartDate() {
ValueEval[] ve = { new RefEvalImplementation(new NumberEval(DATE_1902_09_26)), new NumberEval(0) };
NumberEval result = (NumberEval) eOMonth.evaluate(ve, ec);
assertEquals(DATE_1902_09_30, result.getNumberValue(), 0);
}
use of org.apache.poi.ss.formula.eval.ValueEval in project poi by apache.
the class TestEOMonth method testBug56688.
@Test
public void testBug56688() {
ValueEval[] ve = { new NumberEval(DATE_1902_09_26), new RefEvalImplementation(new NumberEval(0)) };
NumberEval result = (NumberEval) eOMonth.evaluate(ve, ec);
assertEquals(DATE_1902_09_30, result.getNumberValue(), 0);
}
use of org.apache.poi.ss.formula.eval.ValueEval in project poi by apache.
the class TestEOMonth method testEOMonthZeroDate.
@Test
public void testEOMonthZeroDate() {
NumberEval result = (NumberEval) eOMonth.evaluate(new ValueEval[] { new NumberEval(0), new NumberEval(0) }, ec);
assertEquals("0 startDate is 1900-01-00", DATE_1900_01_31, result.getNumberValue(), 0);
result = (NumberEval) eOMonth.evaluate(new ValueEval[] { new NumberEval(0), new NumberEval(1) }, ec);
assertEquals("0 startDate is 1900-01-00", DATE_1900_02_28, result.getNumberValue(), 0);
}
use of org.apache.poi.ss.formula.eval.ValueEval in project poi by apache.
the class TestIntercept 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);
}
use of org.apache.poi.ss.formula.eval.ValueEval in project poi by apache.
the class TestMatch method testSimpleNumber.
public void testSimpleNumber() {
ValueEval[] values = { new NumberEval(4), new NumberEval(5), new NumberEval(10), new NumberEval(10), new NumberEval(25) };
AreaEval ae = EvalFactory.createAreaEval("A1:A5", values);
confirmInt(2, invokeMatch(new NumberEval(5), ae, MATCH_LARGEST_LTE));
confirmInt(2, invokeMatch(new NumberEval(5), ae));
confirmInt(2, invokeMatch(new NumberEval(5), ae, MATCH_EXACT));
confirmInt(4, invokeMatch(new NumberEval(10), ae, MATCH_LARGEST_LTE));
confirmInt(3, invokeMatch(new NumberEval(10), ae, MATCH_EXACT));
confirmInt(4, invokeMatch(new NumberEval(20), ae, MATCH_LARGEST_LTE));
assertEquals(ErrorEval.NA, invokeMatch(new NumberEval(20), ae, MATCH_EXACT));
}
Aggregations