use of org.apache.poi.ss.formula.eval.ValueEval in project poi by apache.
the class TestEDate method testEDateBlankRefValueEval.
@Test
public void testEDateBlankRefValueEval() {
EDate eDate = new EDate();
NumberEval result = (NumberEval) eDate.evaluate(new ValueEval[] { new RefEvalImplementation(BlankEval.instance), new NumberEval(0) }, null);
assertEquals("0 startDate triggers BAD_DATE currently, thus -1.0!", -1.0d, result.getNumberValue(), 0);
result = (NumberEval) eDate.evaluate(new ValueEval[] { new NumberEval(1), new RefEvalImplementation(BlankEval.instance) }, null);
assertEquals("Blank is handled as 0 otherwise", 1.0d, result.getNumberValue(), 0);
}
use of org.apache.poi.ss.formula.eval.ValueEval in project poi by apache.
the class TestEDate method testEDateBlankValueEval.
@Test
public void testEDateBlankValueEval() {
NumberEval evaluate = (NumberEval) new EDate().evaluate(new ValueEval[] { BlankEval.instance, new NumberEval(0) }, null);
assertEquals(-1.0d, evaluate.getNumberValue(), 0);
}
use of org.apache.poi.ss.formula.eval.ValueEval in project poi by apache.
the class TestEDate method testRefEvalStartDate.
@Test
public void testRefEvalStartDate() {
EDate eDate = new EDate();
NumberEval result = (NumberEval) eDate.evaluate(new ValueEval[] { new RefEvalImplementation(new NumberEval(1000)), new NumberEval(0) }, null);
assertEquals(1000d, result.getNumberValue(), 0);
}
use of org.apache.poi.ss.formula.eval.ValueEval in project poi by apache.
the class TestEOMonth method checkValue.
private void checkValue(double startDate, int monthInc, double expectedResult) {
ValueEval[] ve = { new NumberEval(startDate), new NumberEval(monthInc) };
NumberEval result = (NumberEval) eOMonth.evaluate(ve, ec);
assertEquals(expectedResult, result.getNumberValue(), 0);
}
use of org.apache.poi.ss.formula.eval.ValueEval in project poi by apache.
the class TestEDate method testBug56688.
@Test
public void testBug56688() {
EDate eDate = new EDate();
NumberEval result = (NumberEval) eDate.evaluate(new ValueEval[] { new NumberEval(1000), new RefEvalImplementation(new NumberEval(0)) }, null);
assertEquals(1000d, result.getNumberValue(), 0);
}
Aggregations