use of org.apache.poi.ss.formula.eval.ValueEval in project poi by apache.
the class TestWorkdayFunction method testReturnRetroativeWorkday.
@Test
public void testReturnRetroativeWorkday() {
Calendar expCal = LocaleUtil.getLocaleCalendar(2008, 8, 23);
Date expDate = expCal.getTime();
ValueEval[] ve = { new StringEval(STARTING_DATE), new NumberEval(-5), new StringEval(RETROATIVE_HOLIDAY) };
double numberValue = ((NumberEval) WorkdayFunction.instance.evaluate(ve, EC)).getNumberValue();
Date actDate = DateUtil.getJavaDate(numberValue);
assertEquals(expDate, actDate);
}
use of org.apache.poi.ss.formula.eval.ValueEval in project poi by apache.
the class TestWorkdayFunction method testReturnWorkdays.
@Test
public void testReturnWorkdays() {
Calendar expCal = LocaleUtil.getLocaleCalendar(2009, 3, 30);
Date expDate = expCal.getTime();
ValueEval[] ve = { new StringEval(STARTING_DATE), new NumberEval(151) };
Date actDate = DateUtil.getJavaDate(((NumberEval) WorkdayFunction.instance.evaluate(ve, EC)).getNumberValue());
assertEquals(expDate, actDate);
}
use of org.apache.poi.ss.formula.eval.ValueEval in project poi by apache.
the class TestWorkdayFunction method testReturnWorkdaysSpanningAWeekendAddingDays.
@Test
public void testReturnWorkdaysSpanningAWeekendAddingDays() {
Calendar expCal = LocaleUtil.getLocaleCalendar(2013, 8, 30);
Date expDate = expCal.getTime();
ValueEval[] ve = { new StringEval("2013/09/27"), new NumberEval(1) };
double numberValue = ((NumberEval) WorkdayFunction.instance.evaluate(ve, EC)).getNumberValue();
assertEquals(41547.0, numberValue, 0);
Date actDate = DateUtil.getJavaDate(numberValue);
assertEquals(expDate, actDate);
}
use of org.apache.poi.ss.formula.eval.ValueEval in project poi by apache.
the class TestDec2Hex method testWithErrorPlaces.
public void testWithErrorPlaces() {
OperationEvaluationContext ctx = createContext();
ValueEval[] args = new ValueEval[] { ctx.getRefEval(0, 0), ErrorEval.NULL_INTERSECTION };
ValueEval result = new Dec2Hex().evaluate(args, -1, -1);
assertEquals(ErrorEval.class, result.getClass());
assertEquals(ErrorEval.NULL_INTERSECTION, result);
}
use of org.apache.poi.ss.formula.eval.ValueEval in project poi by apache.
the class TestDec2Bin method testWithPlaces.
public void testWithPlaces() {
OperationEvaluationContext ctx = createContext();
ValueEval[] args = new ValueEval[] { ctx.getRefEval(0, 0), ctx.getRefEval(0, 1) };
ValueEval result = new Dec2Bin().evaluate(args, ctx);
assertEquals("Had: " + result, StringEval.class, result.getClass());
// TODO: documentation and behavior do not match here!
assertEquals("1101", ((StringEval) result).getStringValue());
}
Aggregations