Package org.apache.poi.ss.formula.eval

Examples of org.apache.poi.ss.formula.eval.NumberEval


        confirmPercentile(percentile, values, 1.95);
    }

    //percentile has to be between 0 and 1 - here we test less than zero
    public void testUnusualArgs2() {
        ValueEval[] values = { new NumberEval(1), new NumberEval(2), };
        ValueEval percentile = new NumberEval(-0.1);
        confirmPercentile(percentile, values, ErrorEval.NUM_ERROR);
    }
View Full Code Here


        confirmPercentile(percentile, values, ErrorEval.NUM_ERROR);
    }

    //percentile has to be between 0 and 1 - here we test more than 1
    public void testUnusualArgs3() {
        ValueEval[] values = { new NumberEval(1), new NumberEval(2) };
        ValueEval percentile = new NumberEval(1.1);
        confirmPercentile(percentile, values, ErrorEval.NUM_ERROR);
    }
View Full Code Here

        confirmPercentile(percentile, values, ErrorEval.NUM_ERROR);
    }

    //here we test where there are errors as part of inputs
    public void testErrors() {
        ValueEval[] values = { new NumberEval(1), ErrorEval.NAME_INVALID, new NumberEval(3), ErrorEval.DIV_ZERO, };
        ValueEval percentile = new NumberEval(0.95);
        confirmPercentile(percentile, values, ErrorEval.NAME_INVALID);
    }
View Full Code Here

        confirmPercentile(percentile, values, ErrorEval.NAME_INVALID);
    }

    //here we test where there are errors as part of inputs
    public void testErrors2() {
        ValueEval[] values = { new NumberEval(1), new NumberEval(2), new NumberEval(3), ErrorEval.DIV_ZERO, };
        ValueEval percentile = new NumberEval(0.95);
        confirmPercentile(percentile, values, ErrorEval.DIV_ZERO);
    }
View Full Code Here

                new ValueEval[]{ new StringEval("Potato"), new StringEval("Cucumber") }, EC));
    }

    public void testReturnWorkdays() {
        assertEquals(new Date(109, APRIL, 30), DateUtil.getJavaDate(((NumberEval) WorkdayFunction.instance.evaluate(new ValueEval[]{
                new StringEval(STARTING_DATE.toString()), new NumberEval(151) }, EC)).getNumberValue()));
    }
View Full Code Here

      String startDate = "2013/09/30";
      int days = -1;
      String expectedWorkDay = "2013/09/27";
    StringEval stringEval = new StringEval(startDate);
    double numberValue = ((NumberEval) WorkdayFunction.instance.evaluate(new ValueEval[]{
                stringEval, new NumberEval(days) }, EC)).getNumberValue();
    assertEquals(expectedWorkDay, formatter.format(DateUtil.getJavaDate(numberValue)));
    }
View Full Code Here

      String startDate = "2013/09/27";
      int days = 1;
      String expectedWorkDay = "2013/09/30";
    StringEval stringEval = new StringEval(startDate);
    double numberValue = ((NumberEval) WorkdayFunction.instance.evaluate(new ValueEval[]{
                stringEval, new NumberEval(days) }, EC)).getNumberValue();
    assertEquals(expectedWorkDay, formatter.format(DateUtil.getJavaDate(numberValue)));
    }
View Full Code Here

      String startDate = "2013/10/06";
      int days = 1;
      String expectedWorkDay = "2013/10/07";
    StringEval stringEval = new StringEval(startDate);
    double numberValue = ((NumberEval) WorkdayFunction.instance.evaluate(new ValueEval[]{
                stringEval, new NumberEval(days) }, EC)).getNumberValue();
    assertEquals(expectedWorkDay, formatter.format(DateUtil.getJavaDate(numberValue)));
    }
View Full Code Here

      String startDate = "2013/10/06";
      int days = -1;
      String expectedWorkDay = "2013/10/04";
    StringEval stringEval = new StringEval(startDate);
    double numberValue = ((NumberEval) WorkdayFunction.instance.evaluate(new ValueEval[]{
                stringEval, new NumberEval(days) }, EC)).getNumberValue();
    assertEquals(expectedWorkDay, formatter.format(DateUtil.getJavaDate(numberValue)));
    }
View Full Code Here

    assertEquals(expectedWorkDay, formatter.format(DateUtil.getJavaDate(numberValue)));
    }

    public void testReturnWorkdaysWithDaysTruncated() {
        assertEquals(new Date(109, APRIL, 30), DateUtil.getJavaDate(((NumberEval) WorkdayFunction.instance.evaluate(new ValueEval[]{
                new StringEval(STARTING_DATE.toString()), new NumberEval(151.99999) }, EC)).getNumberValue()));
    }
View Full Code Here

TOP

Related Classes of org.apache.poi.ss.formula.eval.NumberEval

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.