Class ExpressionEvalTest

  • Direct Known Subclasses:
    ExtExpressionEvalTest

    public class ExpressionEvalTest
    extends java.lang.Object
    This class is designed for testing the validity of Jep evaluations. Expressions from a text file are evaluated with Jep in pairs of two, and the results are compared. If they do not match, the two expressions are printed to standard output.

    Take for example an input text file containing the two lines

    1+2
    3.
    The expressions '1+2' and '3' are evaluated with Jep and the results compared.
    Author:
    Nathan Funk
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected int lineCount
      Current line position
    • Constructor Summary

      Constructors 
      Constructor Description
      ExpressionEvalTest()
      Creates a new ExpressionEvalTest instance
    • Field Detail

      • lineCount

        protected int lineCount
        Current line position
    • Constructor Detail

      • ExpressionEvalTest

        public ExpressionEvalTest()
        Creates a new ExpressionEvalTest instance
    • Method Detail

      • main

        public static void main​(java.lang.String[] args)
        The main method checks the arguments and creates an instance and runs a test
      • testStandard

        public void testStandard()
                          throws java.lang.Exception
        Throws:
        java.lang.Exception
      • testFast

        public void testFast()
                      throws java.lang.Exception
        Throws:
        java.lang.Exception
      • testConfParser

        public void testConfParser()
                            throws java.lang.Exception
        Throws:
        java.lang.Exception
      • testPostfixEvaluator

        public void testPostfixEvaluator()
                                  throws java.lang.Exception
        Throws:
        java.lang.Exception
      • testReals

        public void testReals()
                       throws java.lang.Exception
        Throws:
        java.lang.Exception
      • testJepInstance

        public void testJepInstance​(Jep jep,
                                    java.lang.String fileName)
        Loads the file specified in fileName. Evaluates the expressions listed in it and compares the expressions with the results.
      • testJepInstance

        public void testJepInstance​(Jep jep,
                                    java.io.BufferedReader reader)
      • println

        protected static void println​(java.lang.String str)
        Helper function for printing lines.