use of org.apache.poi.ss.formula.OperationEvaluationContext in project poi by apache.
the class TestDec2Bin method testWithNegativePlaces.
public void testWithNegativePlaces() {
OperationEvaluationContext ctx = createContext();
ValueEval[] args = new ValueEval[] { ctx.getRefEval(0, 0), ctx.getRefEval(0, 2) };
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 testWithPlacesIntInt.
public void testWithPlacesIntInt() {
OperationEvaluationContext ctx = createContext();
ValueEval[] args = new ValueEval[] { ctx.getRefEval(0, 0), ctx.getRefEval(0, 1) };
ValueEval result = new Dec2Bin().evaluate(args, -1, -1);
assertEquals("Had: " + result, StringEval.class, result.getClass());
// TODO: documentation and behavior do not match here!
assertEquals("1101", ((StringEval) result).getStringValue());
}
use of org.apache.poi.ss.formula.OperationEvaluationContext in project poi by apache.
the class TestDec2Bin method testWithToShortPlaces.
public void testWithToShortPlaces() {
OperationEvaluationContext ctx = createContext();
ValueEval[] args = new ValueEval[] { ctx.getRefEval(0, 0), ctx.getRefEval(0, 3) };
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 TestDec2Hex method testEvalOperationEvaluationContextFails.
public void testEvalOperationEvaluationContextFails() {
OperationEvaluationContext ctx = createContext();
ValueEval[] args = new ValueEval[] { ErrorEval.VALUE_INVALID };
ValueEval result = new Dec2Hex().evaluate(args, ctx);
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 testWithTooManyParams.
public void testWithTooManyParams() {
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, ctx);
assertEquals(ErrorEval.class, result.getClass());
assertEquals(ErrorEval.VALUE_INVALID, result);
}
Aggregations