Search in sources :

Example 81 with ValueEval

use of org.apache.poi.ss.formula.eval.ValueEval in project poi by apache.

the class TestDec2Hex method testWithNegativePlaces.

public void testWithNegativePlaces() {
    OperationEvaluationContext ctx = createContext();
    ValueEval[] args = new ValueEval[] { ctx.getRefEval(0, 0), ctx.getRefEval(0, 2) };
    ValueEval result = new Dec2Hex().evaluate(args, -1, -1);
    assertEquals(ErrorEval.class, result.getClass());
    assertEquals(ErrorEval.NUM_ERROR, result);
}
Also used : OperationEvaluationContext(org.apache.poi.ss.formula.OperationEvaluationContext) ValueEval(org.apache.poi.ss.formula.eval.ValueEval)

Example 82 with ValueEval

use of org.apache.poi.ss.formula.eval.ValueEval in project poi by apache.

the class TestDec2Hex 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 Dec2Hex().evaluate(args, -1, -1);
    assertEquals(ErrorEval.class, result.getClass());
    assertEquals(ErrorEval.VALUE_INVALID, result);
}
Also used : OperationEvaluationContext(org.apache.poi.ss.formula.OperationEvaluationContext) ValueEval(org.apache.poi.ss.formula.eval.ValueEval)

Example 83 with ValueEval

use of org.apache.poi.ss.formula.eval.ValueEval 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);
}
Also used : OperationEvaluationContext(org.apache.poi.ss.formula.OperationEvaluationContext) ValueEval(org.apache.poi.ss.formula.eval.ValueEval)

Example 84 with ValueEval

use of org.apache.poi.ss.formula.eval.ValueEval 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());
}
Also used : OperationEvaluationContext(org.apache.poi.ss.formula.OperationEvaluationContext) ValueEval(org.apache.poi.ss.formula.eval.ValueEval)

Example 85 with ValueEval

use of org.apache.poi.ss.formula.eval.ValueEval 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);
}
Also used : OperationEvaluationContext(org.apache.poi.ss.formula.OperationEvaluationContext) ValueEval(org.apache.poi.ss.formula.eval.ValueEval) NumberEval(org.apache.poi.ss.formula.eval.NumberEval)

Aggregations

ValueEval (org.apache.poi.ss.formula.eval.ValueEval)223 NumberEval (org.apache.poi.ss.formula.eval.NumberEval)101 StringEval (org.apache.poi.ss.formula.eval.StringEval)48 Test (org.junit.Test)39 EvaluationException (org.apache.poi.ss.formula.eval.EvaluationException)36 AreaEval (org.apache.poi.ss.formula.eval.AreaEval)29 NumericValueEval (org.apache.poi.ss.formula.eval.NumericValueEval)28 OperationEvaluationContext (org.apache.poi.ss.formula.OperationEvaluationContext)27 Calendar (java.util.Calendar)16 ErrorEval (org.apache.poi.ss.formula.eval.ErrorEval)13 Date (java.util.Date)11 RefEval (org.apache.poi.ss.formula.eval.RefEval)9 TwoDEval (org.apache.poi.ss.formula.TwoDEval)7 BlankEval (org.apache.poi.ss.formula.eval.BlankEval)4 NotImplementedException (org.apache.poi.ss.formula.eval.NotImplementedException)4 StringValueEval (org.apache.poi.ss.formula.eval.StringValueEval)4 ValueVector (org.apache.poi.ss.formula.functions.LookupUtils.ValueVector)4 ArrayList (java.util.ArrayList)3 AssertionFailedError (junit.framework.AssertionFailedError)3 BoolEval (org.apache.poi.ss.formula.eval.BoolEval)3