use of org.apache.poi.ss.formula.eval.ValueEval in project poi by apache.
the class TestDec2Bin method testEvalOperationEvaluationContext.
public void testEvalOperationEvaluationContext() {
OperationEvaluationContext ctx = createContext();
ValueEval[] args = new ValueEval[] { ctx.getRefEval(0, 0) };
ValueEval result = new Dec2Bin().evaluate(args, ctx);
assertEquals(StringEval.class, result.getClass());
assertEquals("1101", ((StringEval) result).getStringValue());
}
use of org.apache.poi.ss.formula.eval.ValueEval in project poi by apache.
the class TestDec2Bin method testWithErrorPlaces.
public void testWithErrorPlaces() {
OperationEvaluationContext ctx = createContext();
ValueEval[] args = new ValueEval[] { ctx.getRefEval(0, 0), ErrorEval.NULL_INTERSECTION };
ValueEval result = new Dec2Bin().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 TestAverage method confirmAverage.
private void confirmAverage(ValueEval[] args, ErrorEval expectedError) {
ValueEval result = invokeAverage(args);
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 TestBin2Dec method testEvalOperationEvaluationContext.
public void testEvalOperationEvaluationContext() {
OperationEvaluationContext ctx = createContext();
ValueEval[] args = new ValueEval[] { ctx.getRefEval(0, 0) };
ValueEval result = new Bin2Dec().evaluate(args, ctx);
assertEquals(NumberEval.class, result.getClass());
assertEquals("0", ((NumberEval) result).getStringValue());
}
use of org.apache.poi.ss.formula.eval.ValueEval in project poi by apache.
the class TestWorkdayFunction method testReturnWorkdaysWithDaysTruncated.
@Test
public void testReturnWorkdaysWithDaysTruncated() {
Calendar expCal = LocaleUtil.getLocaleCalendar(2009, 3, 30);
Date expDate = expCal.getTime();
ValueEval[] ve = { new StringEval(STARTING_DATE), new NumberEval(151.99999) };
double numberValue = ((NumberEval) WorkdayFunction.instance.evaluate(ve, EC)).getNumberValue();
Date actDate = DateUtil.getJavaDate(numberValue);
assertEquals(expDate, actDate);
}
Aggregations