Search in sources :

Example 51 with NumberEval

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

the class TestEOMonth method checkValue.

private void checkValue(double startDate, int monthInc, double expectedResult) {
    ValueEval[] ve = { new NumberEval(startDate), new NumberEval(monthInc) };
    NumberEval result = (NumberEval) eOMonth.evaluate(ve, ec);
    assertEquals(expectedResult, result.getNumberValue(), 0);
}
Also used : ValueEval(org.apache.poi.ss.formula.eval.ValueEval) NumberEval(org.apache.poi.ss.formula.eval.NumberEval)

Example 52 with NumberEval

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

the class TestEDate method testBug56688.

@Test
public void testBug56688() {
    EDate eDate = new EDate();
    NumberEval result = (NumberEval) eDate.evaluate(new ValueEval[] { new NumberEval(1000), new RefEvalImplementation(new NumberEval(0)) }, null);
    assertEquals(1000d, result.getNumberValue(), 0);
}
Also used : ValueEval(org.apache.poi.ss.formula.eval.ValueEval) NumberEval(org.apache.poi.ss.formula.eval.NumberEval) Test(org.junit.Test)

Example 53 with NumberEval

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

the class TestEOMonth method testRefEvalStartDate.

@Test
public void testRefEvalStartDate() {
    ValueEval[] ve = { new RefEvalImplementation(new NumberEval(DATE_1902_09_26)), new NumberEval(0) };
    NumberEval result = (NumberEval) eOMonth.evaluate(ve, ec);
    assertEquals(DATE_1902_09_30, result.getNumberValue(), 0);
}
Also used : ValueEval(org.apache.poi.ss.formula.eval.ValueEval) NumberEval(org.apache.poi.ss.formula.eval.NumberEval) Test(org.junit.Test)

Example 54 with NumberEval

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

the class TestEOMonth method testBug56688.

@Test
public void testBug56688() {
    ValueEval[] ve = { new NumberEval(DATE_1902_09_26), new RefEvalImplementation(new NumberEval(0)) };
    NumberEval result = (NumberEval) eOMonth.evaluate(ve, ec);
    assertEquals(DATE_1902_09_30, result.getNumberValue(), 0);
}
Also used : ValueEval(org.apache.poi.ss.formula.eval.ValueEval) NumberEval(org.apache.poi.ss.formula.eval.NumberEval) Test(org.junit.Test)

Example 55 with NumberEval

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

the class TestEOMonth method testEOMonthZeroDate.

@Test
public void testEOMonthZeroDate() {
    NumberEval result = (NumberEval) eOMonth.evaluate(new ValueEval[] { new NumberEval(0), new NumberEval(0) }, ec);
    assertEquals("0 startDate is 1900-01-00", DATE_1900_01_31, result.getNumberValue(), 0);
    result = (NumberEval) eOMonth.evaluate(new ValueEval[] { new NumberEval(0), new NumberEval(1) }, ec);
    assertEquals("0 startDate is 1900-01-00", DATE_1900_02_28, result.getNumberValue(), 0);
}
Also used : ValueEval(org.apache.poi.ss.formula.eval.ValueEval) NumberEval(org.apache.poi.ss.formula.eval.NumberEval) Test(org.junit.Test)

Aggregations

NumberEval (org.apache.poi.ss.formula.eval.NumberEval)123 ValueEval (org.apache.poi.ss.formula.eval.ValueEval)101 Test (org.junit.Test)34 StringEval (org.apache.poi.ss.formula.eval.StringEval)29 AreaEval (org.apache.poi.ss.formula.eval.AreaEval)21 EvaluationException (org.apache.poi.ss.formula.eval.EvaluationException)19 Calendar (java.util.Calendar)17 Date (java.util.Date)13 NumericValueEval (org.apache.poi.ss.formula.eval.NumericValueEval)12 ErrorEval (org.apache.poi.ss.formula.eval.ErrorEval)8 I_MatchPredicate (org.apache.poi.ss.formula.functions.CountUtils.I_MatchPredicate)5 RefEval (org.apache.poi.ss.formula.eval.RefEval)4 AssertionFailedError (junit.framework.AssertionFailedError)3 ValueVector (org.apache.poi.ss.formula.functions.LookupUtils.ValueVector)3 HSSFWorkbook (org.apache.poi.hssf.usermodel.HSSFWorkbook)2 BoolEval (org.apache.poi.ss.formula.eval.BoolEval)2 Workbook (org.apache.poi.ss.usermodel.Workbook)2 DateFormatSymbols (java.text.DateFormatSymbols)1 DecimalFormatSymbols (java.text.DecimalFormatSymbols)1 SimpleDateFormat (java.text.SimpleDateFormat)1