Package org.apache.poi.hssf.record.formula.eval

Examples of org.apache.poi.hssf.record.formula.eval.Eval


    assertEquals(NumberEval.class, result.getClass());
    assertEquals(expected, ((NumberEval)result).getNumberValue(), 0);
  }

  private void confirmAverage(Eval[] args, ErrorEval expectedError) {
    Eval result = invokeAverage(args);
    assertEquals(ErrorEval.class, result.getClass());
    assertEquals(expectedError.getErrorCode(), ((ErrorEval)result).getErrorCode());
  }
View Full Code Here


  /**
   * @return the result of calling function T() with the specified argument
   */
  private static Eval invokeT(Eval arg) {
    Eval[] args = { arg, };
    Eval result = new T().evaluate(args, -1, (short)-1);
    assertNotNull("result may never be null", result);
    return result;
  }
View Full Code Here

  /**
   * Simulates call: T(A1)
   * where cell A1 has the specified innerValue
   */
  private Eval invokeTWithReference(ValueEval innerValue) {
    Eval arg = new Ref2DEval(new ReferencePtg((short)1, (short)1, false, false), innerValue);
    return invokeT(arg);
  }
View Full Code Here

    Eval arg = new Ref2DEval(new ReferencePtg((short)1, (short)1, false, false), innerValue);
    return invokeT(arg);
  }
 
  private static void confirmText(String text) {
    Eval arg = new StringEval(text);
    Eval eval = invokeT(arg);
    StringEval se = (StringEval) eval;
    assertEquals(text, se.getStringValue());
  }
View Full Code Here

    confirmText("123");
    confirmText("TRUE");
  }
 
  private static void confirmError(Eval arg) {
    Eval eval = invokeT(arg);
    assertTrue(arg == eval);
  }
View Full Code Here

    assertTrue(eval instanceof StringEval);
    assertEquals(expected, ((StringEval)eval).getStringValue());
  }

  private static void confirmOther(Eval arg) {
    Eval eval = invokeT(arg);
    confirmString(eval, "");
  }
View Full Code Here

    confirmOther(BoolEval.FALSE);
    confirmOther(BlankEval.INSTANCE)// can this particular case be verified?
  }

  public void testRefValues() {
    Eval eval;
   
    eval = invokeTWithReference(new StringEval("def"));
    confirmString(eval, "def");
    eval = invokeTWithReference(new StringEval(" "));
    confirmString(eval, " ");
View Full Code Here

  }
  /**
   * Invocation when not expecting an error result
   */
  private static NumberEval invokeNormal(Eval[] args) {
    Eval ev = invoke(args);
    if(ev instanceof ErrorEval) {
      throw new AssertionFailedError("Normal evaluation failed with error code: "
          + ev.toString());
    }
    return (NumberEval) ev;
  }
View Full Code Here

    Eval[] args = {
        new NumberEval(0.005),
        new NumberEval(24),
        new NumberEval(1000),
    };
    Eval ev = invoke(args);
    if(ev instanceof ErrorEval) {
      ErrorEval err = (ErrorEval) ev;
      if(err.getErrorCode() == HSSFErrorConstants.ERROR_VALUE) {
        throw new AssertionFailedError("Identified bug 44691");
      }
View Full Code Here

    Eval[] args = new Eval[] { text, };
    return new Trim().evaluate(args, -1, (short)-1);
  }

  private void confirmTrim(Eval text, String expected) {
    Eval result = invokeTrim(text);
    assertEquals(StringEval.class, result.getClass());
    assertEquals(expected, ((StringEval)result).getStringValue());
  }
View Full Code Here

TOP

Related Classes of org.apache.poi.hssf.record.formula.eval.Eval

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.