use of org.apache.poi.ss.formula.OperationEvaluationContext in project poi by apache.
the class TestDec2Bin method testWithEmptyPlaces.
public void testWithEmptyPlaces() {
OperationEvaluationContext ctx = createContext();
ValueEval[] args = new ValueEval[] { ctx.getRefEval(0, 0), ctx.getRefEval(1, 0) };
ValueEval result = new Dec2Bin().evaluate(args, -1, -1);
assertEquals(ErrorEval.class, result.getClass());
assertEquals(ErrorEval.VALUE_INVALID, result);
}
use of org.apache.poi.ss.formula.OperationEvaluationContext in project poi by apache.
the class TestDec2Bin method testRefs.
public void testRefs() {
OperationEvaluationContext ctx = createContext();
ValueEval[] args = new ValueEval[] { ctx.getRefEval(0, 0) };
ValueEval result = new Dec2Bin().evaluate(args, -1, -1);
assertEquals("Had: " + result, StringEval.class, result.getClass());
assertEquals("1101", ((StringEval) result).getStringValue());
}
use of org.apache.poi.ss.formula.OperationEvaluationContext in project poi by apache.
the class TestDec2Bin method testWithZeroPlaces.
public void testWithZeroPlaces() {
OperationEvaluationContext ctx = createContext();
ValueEval[] args = new ValueEval[] { ctx.getRefEval(0, 0), new NumberEval(0.0) };
ValueEval result = new Dec2Bin().evaluate(args, -1, -1);
assertEquals(ErrorEval.class, result.getClass());
assertEquals(ErrorEval.NUM_ERROR, result);
}
use of org.apache.poi.ss.formula.OperationEvaluationContext in project poi by apache.
the class TestDec2Bin method testWithTooManyParamsIntInt.
public void testWithTooManyParamsIntInt() {
OperationEvaluationContext ctx = createContext();
ValueEval[] args = new ValueEval[] { ctx.getRefEval(0, 0), ctx.getRefEval(0, 1), ctx.getRefEval(0, 1) };
ValueEval result = new Dec2Bin().evaluate(args, -1, -1);
assertEquals(ErrorEval.class, result.getClass());
assertEquals(ErrorEval.VALUE_INVALID, result);
}
use of org.apache.poi.ss.formula.OperationEvaluationContext in project poi by apache.
the class TestHex2Dec method testEvalOperationEvaluationContext.
public void testEvalOperationEvaluationContext() {
OperationEvaluationContext ctx = createContext();
ValueEval[] args = new ValueEval[] { ctx.getRefEval(0, 0) };
ValueEval result = new Hex2Dec().evaluate(args, ctx);
assertEquals(NumberEval.class, result.getClass());
assertEquals("0", ((NumberEval) result).getStringValue());
}
Aggregations