Package com.singularsys.jeptests.system

# Class JepTest

java.lang.Object
com.singularsys.jeptests.system.JepTest

Direct Known Subclasses:
  `BigDecimalStandardTests`, `CPTest`, `ExtendedParserTest`, `JepTestWithCustomNumberType`, `NullWrapTest`, `PostfixEvalTest`, `StandardEvaluatorTest`, `UncheckedEvalTest`

public class JepTest extends Object
Tests various functions on the Jep class. The current implementation tests using the default setup with the JavaCC parser.

Printing of tests can be supressed by setting the DO_NOT_PRINT_TESTS environment variable

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static class`
  `JepTest.AddFractionsNary`
  NaryFunction to add fractions
  `static class`
  `JepTest.AddFractionsStack`
  Function to add fractions using a stack
  `static class`
  `JepTest.Diff`
  Function for diference of two variables.
  `protected static class`
  `JepTest.MyBinary`
  A binary function
  `protected static class`
  `JepTest.MyNary`
  An Nary function
  `protected static class`
  `JepTest.MyNaryBinary`
  An NaryBinary function
  `protected static class`
  `JepTest.MyNullary`
  A nullary functions
  `protected static class`
  `JepTest.MyUnary`
  A unary function
  `static class`
  `JepTest.PiFun`
  Real nullay function
  `static class`
  `JepTest.Product`
  Product of values
  `static class`
  `JepTest.Square`
  Square of value

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected Jep`
  `jep`
  The parser
  `protected Object`
  `myFalse`
  `protected Object`
  `myTrue`
  `static final boolean`
  `PRINT_RESULTS`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `JepTest()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected void`
  `assertEqNodes(String s, Node expected, Node actual)`
  `protected Object`
  `buildMatrix(Object[]... eles)`
  `protected Object`
  `buildVector(Object... eles)`
  `protected Object`
  `calcValue(Node node)`
  Calculate the value of an expression.
  `protected Object`
  `calcValue(String expr)`
  Calculate the value of an expression.
  `void`
  `checkVector(Object[] expected, Object actual)`
  `protected boolean`
  `compareRecursive(Node node1, Node node2)`
  `protected void`
  `complexValueTest(String expr, Complex expected, double tol)`
  Test parse-evaluate with complex number and given tolerance.
  `protected Object`
  `getNumber(Object val)`
  Create a number of the appropriate type
  `protected void`
  `myAssertEquals(String msg, Object expected, Object actual)`
  `protected void`
  `myAssertNaN(String msg, Object actual)`
  `protected void`
  `myAssertNull(String msg, Object actual)`
  `protected Object`
  `negativeZero()`
  `static void`
  `nodeTest(Node n, Operator op)`
  `static void`
  `nodeTest(Node n, Variable v)`
  `static void`
  `nodeTest(Node n, Object v)`
  `static void`
  `nodeTest(Node n, String name)`
  `protected void`
  `printTestHeader(String str)`
  Prints a header with the name of the test as specified in str.
  `protected void`
  `setShiftZeroElePfmc()`
  `void`
  `setUp()`
  Sets up the parser.
  `void`
  `test_adding_existing_constant_fails()`
  `void`
  `test_not_X_Y()`
  `void`
  `test_parser_sets_parent()`
  `void`
  `testAssign()`
  `void`
  `testBinom()`
  `void`
  `testBlankParser()`
  Test creating a Jep instance with no functions and no variables.
  `void`
  `testCaseNull()`
  `void`
  `testCaseString()`
  `void`
  `testChangeVariable()`
  Test changing variables value after parsing
  `void`
  `testChangeVariableComplex()`
  Test changing variables value after parsing
  `void`
  `testComments()`
  `void`
  `testComplex()`
  `void`
  `testComplexListAccess()`
  `void`
  `testEleUnit()`
  `void`
  `testEmptyEqn()`
  `void`
  `testEmptyEqn2()`
  `void`
  `testEvalExceptions()`
  Test whether evaluation exceptions are thrown when they should be.
  `void`
  `testEvaluate()`
  Tests the `evaluate()` method.
  `void`
  `testEvaluateComplex()`
  `void`
  `testEvaluateString()`
  `void`
  `testExpectedTokenSequence()`
  Tests for bug #52
  `void`
  `testFormat()`
  `void`
  `testFunction()`
  `void`
  `testIf()`
  `void`
  `testImplicitMul()`
  `void`
  `testLazyLogical()`
  `void`
  `testLazyLogical2()`
  `void`
  `testLazyLogicalBug()`
  Test for bug with 1&&1&&1
  `void`
  `testListAccess()`
  `void`
  `testListAccessShiftZero()`
  `void`
  `testListExtra()`
  `void`
  `testListFunctions()`
  `void`
  `testListOperations()`
  `void`
  `testLogarithm()`
  `void`
  `testLogical()`
  `void`
  `testMacroFunction()`
  `void`
  `testMultiDimArray()`
  `void`
  `testMultiDimArrayShiftZero()`
  `void`
  `testMultiLine()`
  `void`
  `testMultiplyBug()`
  `void`
  `testNaN()`
  `void`
  `testNoAssign()`
  `void`
  `testNull()`
  `void`
  `testNumberAsBooleanLogical()`
  `void`
  `testNumbers()`
  `void`
  `testNumParam()`
  `void`
  `testParseException()`
  Tests whether a parse exceptions are thrown when they should be.
  `void`
  `testPlusPlus()`
  `void`
  `testRecursiveMacroFunction()`
  `void`
  `testSemiColon()`
  `void`
  `testSetAllowUndeclared()`
  Tests whether allowUndeclared is working properly.
  `void`
  `testSimpleSum()`
  `void`
  `testSpecialFunctions()`
  `void`
  `testSpecialFunctions(boolean hasRealEval, boolean hasCallback)`
  `void`
  `testStrings()`
  `void`
  `testStringsFun()`
  `void`
  `testSwitch()`
  `void`
  `testUminusPower()`
  `void`
  `testX2Y()`
  `protected void`
  `valueTest(String expr, double a, double tol)`
  Test values to within a given precision
  `protected void`
  `valueTest(String expr, Object expected)`
  Test result j.evaluate(j.parse(expr))
  `protected void`
  `valueTestFail(String expr)`
  Test whether evaluating an expression results in an exception
  `protected void`
  `valueTestNaN(String expr)`
  Test whether an expression evaluates to NaN
  `protected void`
  `valueTestNull(String expr)`
  `protected void`
  `valueTestString(String expr, String expected)`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### PRINT_RESULTS

    public static final boolean PRINT_RESULTS

  - ### jep

    protected Jep jep
    The parser

  - ### myTrue

    protected Object myTrue

  - ### myFalse

    protected Object myFalse

- ## Constructor Details

  - ### JepTest

    public JepTest()

- ## Method Details

  - ### setUp

    @BeforeEach public void setUp()
    Sets up the parser.

  - ### printTestHeader

    protected void printTestHeader(String str)
    Prints a header with the name of the test as specified in str.

  - ### valueTest

    protected void valueTest(String expr, Object expected) throws JepException
    Test result j.evaluate(j.parse(expr))
    Parameters:
      `expr` - the expression to parse and evaluate
      `expected` - result expected
    Throws:
      `JepException`

  - ### calcValue

    protected Object calcValue(Node node) throws JepException
    Calculate the value of an expression.
    Parameters:
      `node` -
    Throws:
      `JepException`

  - ### getNumber

    protected Object getNumber(Object val)
    Create a number of the appropriate type
    Parameters:
      `val` - input
    Returns:
      converted number

  - ### negativeZero

    protected Object negativeZero()

  - ### calcValue

    protected Object calcValue(String expr) throws JepException
    Calculate the value of an expression.
    Parameters:
      `expr` -
    Throws:
      `JepException`

  - ### myAssertEquals

    protected void myAssertEquals(String msg, Object expected, Object actual) throws EvaluationException
    Throws:
      `EvaluationException`

  - ### myAssertNaN

    protected void myAssertNaN(String msg, Object actual)

  - ### myAssertNull

    protected void myAssertNull(String msg, Object actual)

  - ### valueTestNull

    protected void valueTestNull(String expr) throws Exception
    Throws:
      `Exception`

  - ### valueTestNaN

    protected void valueTestNaN(String expr) throws Exception
    Test whether an expression evaluates to NaN
    Parameters:
      `expr` -
    Throws:
      `Exception`

  - ### valueTestFail

    protected void valueTestFail(String expr) throws Exception
    Test whether evaluating an expression results in an exception
    Parameters:
      `expr` -
    Throws:
      `Exception`

  - ### valueTestString

    protected void valueTestString(String expr, String expected) throws Exception
    Throws:
      `Exception`

  - ### complexValueTest

    protected void complexValueTest(String expr, Complex expected, double tol) throws Exception
    Test parse-evaluate with complex number and given tolerance.
    Parameters:
      `expr` -
      `expected` -
      `tol` -
    Throws:
      `Exception`

  - ### valueTest

    protected void valueTest(String expr, double a, double tol) throws Exception
    Test values to within a given precision
    Parameters:
      `expr` - expression
      `a` - the expected value
      `tol` - tolerance
    Throws:
      `Exception`

  - ### nodeTest

    public static void nodeTest(Node n, Operator op)

  - ### nodeTest

    public static void nodeTest(Node n, String name)

  - ### nodeTest

    public static void nodeTest(Node n, Variable v)

  - ### nodeTest

    public static void nodeTest(Node n, Object v)

  - ### compareRecursive

    protected boolean compareRecursive(Node node1, Node node2)

  - ### assertEqNodes

    protected void assertEqNodes(String s, Node expected, Node actual)

  - ### testSimpleSum

    @Test public void testSimpleSum() throws Exception
    Throws:
      `Exception`

  - ### testEvaluate

    @Test public void testEvaluate() throws Exception
    Tests the `evaluate()` method.
    Throws:
      `Exception`

  - ### test_parser_sets_parent

    @Test public void test_parser_sets_parent() throws Exception
    Throws:
      `Exception`

  - ### testEvaluateComplex

    @Test public void testEvaluateComplex() throws Exception
    Throws:
      `Exception`

  - ### testEvaluateString

    @Test public void testEvaluateString() throws Exception
    Throws:
      `Exception`

  - ### testChangeVariable

    @Test public void testChangeVariable() throws Exception
    Test changing variables value after parsing
    Throws:
      `Exception`

  - ### testChangeVariableComplex

    @Test public void testChangeVariableComplex() throws Exception
    Test changing variables value after parsing
    Throws:
      `Exception`

  - ### testSetAllowUndeclared

    @Test public void testSetAllowUndeclared() throws Exception
    Tests whether allowUndeclared is working properly.
    Throws:
      `Exception`

  - ### testNumbers

    @Test public void testNumbers() throws Exception
    Throws:
      `Exception`

  - ### testStrings

    @Test public void testStrings() throws Exception
    Throws:
      `Exception`

  - ### testStringsFun

    @Test public void testStringsFun() throws Exception
    Throws:
      `Exception`

  - ### testNumberAsBooleanLogical

    @Test public void testNumberAsBooleanLogical() throws Exception
    Throws:
      `Exception`

  - ### test_adding_existing_constant_fails

    @Test public void test_adding_existing_constant_fails() throws Exception
    Throws:
      `Exception`

  - ### testLogical

    @Test public void testLogical() throws Exception
    Throws:
      `Exception`

  - ### testNull

    @Test public void testNull() throws Exception
    Throws:
      `Exception`

  - ### testNaN

    @Test public void testNaN() throws Exception
    Throws:
      `Exception`

  - ### testComplex

    @Test public void testComplex() throws Exception
    Throws:
      `Exception`

  - ### testFunction

    @Test public void testFunction() throws Exception
    Throws:
      `Exception`

  - ### testIf

    @Test public void testIf() throws Exception
    Throws:
      `Exception`

  - ### testPlusPlus

    @Test public void testPlusPlus() throws Exception
    Throws:
      `Exception`

  - ### testImplicitMul

    @Test public void testImplicitMul() throws Exception
    Throws:
      `Exception`

  - ### testUminusPower

    @Test public void testUminusPower() throws Exception
    Throws:
      `Exception`

  - ### testNumParam

    @Test public void testNumParam() throws Exception
    Throws:
      `Exception`

  - ### testBinom

    @Test public void testBinom() throws Exception
    Throws:
      `Exception`

  - ### testFormat

    @Test public void testFormat() throws Exception
    Throws:
      `Exception`

  - ### testAssign

    @Test public void testAssign() throws Exception
    Throws:
      `Exception`

  - ### testMultiplyBug

    @Test public void testMultiplyBug() throws Exception
    Throws:
      `Exception`

  - ### testNoAssign

    @Test public void testNoAssign() throws Exception
    Throws:
      `Exception`

  - ### testLazyLogical

    @Test public void testLazyLogical() throws Exception
    Throws:
      `Exception`

  - ### testLazyLogical2

    @Test public void testLazyLogical2() throws Exception
    Throws:
      `Exception`

  - ### testLazyLogicalBug

    @Test public void testLazyLogicalBug() throws Exception
    Test for bug with 1&&1&&1
    Throws:
      `Exception`

  - ### testLogarithm

    @Test public void testLogarithm() throws Exception
    Throws:
      `Exception`

  - ### testBlankParser

    @Test public void testBlankParser() throws Exception
    Test creating a Jep instance with no functions and no variables.
    Throws:
      `Exception`

  - ### testMacroFunction

    @Test public void testMacroFunction() throws Exception
    Throws:
      `Exception`

  - ### testRecursiveMacroFunction

    @Test public void testRecursiveMacroFunction() throws Exception
    Throws:
      `Exception`

  - ### testParseException

    @Test public void testParseException()
    Tests whether a parse exceptions are thrown when they should be. See ticket #50 Tests on both the standard parser and the configurable parser, is carried out by CPTest which extends this.

  - ### testEvalExceptions

    @Test public void testEvalExceptions()
    Test whether evaluation exceptions are thrown when they should be.

  - ### testSemiColon

    @Test public void testSemiColon() throws Exception
    Throws:
      `Exception`

  - ### testMultiLine

    @Test public void testMultiLine() throws Exception
    Throws:
      `Exception`

  - ### testEmptyEqn

    @Test public void testEmptyEqn() throws Exception
    Throws:
      `Exception`

  - ### testComments

    @Test public void testComments() throws Exception
    Throws:
      `Exception`

  - ### testEmptyEqn2

    @Test public void testEmptyEqn2() throws Exception
    Throws:
      `Exception`

  - ### test_not_X_Y

    @Test public void test_not_X_Y() throws Exception
    Throws:
      `Exception`

  - ### testX2Y

    @Test public void testX2Y() throws Exception
    Throws:
      `Exception`

  - ### testExpectedTokenSequence

    @Test public void testExpectedTokenSequence()
    Tests for bug #52

  - ### testSwitch

    @Test public void testSwitch() throws Exception
    Throws:
      `Exception`

  - ### testCaseString

    @Test public void testCaseString() throws Exception
    Throws:
      `Exception`

  - ### testCaseNull

    @Test public void testCaseNull() throws Exception
    Throws:
      `Exception`

  - ### buildVector

    protected Object buildVector(Object... eles) throws Exception
    Throws:
      `Exception`

  - ### buildMatrix

    protected Object buildMatrix(Object[]... eles) throws Exception
    Throws:
      `Exception`

  - ### testComplexListAccess

    @Test public void testComplexListAccess() throws Exception
    Throws:
      `Exception`

  - ### testListAccess

    @Test public void testListAccess() throws Exception
    Throws:
      `Exception`

  - ### testListOperations

    @Test public void testListOperations() throws Exception
    Throws:
      `Exception`

  - ### testListAccessShiftZero

    @Test public void testListAccessShiftZero() throws Exception
    Throws:
      `Exception`

  - ### checkVector

    public void checkVector(Object[] expected, Object actual) throws EvaluationException
    Throws:
      `EvaluationException`

  - ### testEleUnit

    @Test public void testEleUnit() throws Exception
    Throws:
      `Exception`

  - ### testMultiDimArray

    @Test public void testMultiDimArray() throws Exception
    Throws:
      `Exception`

  - ### testMultiDimArrayShiftZero

    @Test public void testMultiDimArrayShiftZero() throws Exception
    Throws:
      `Exception`

  - ### testListFunctions

    @Test public void testListFunctions() throws Exception
    Throws:
      `Exception`

  - ### testListExtra

    @Test public void testListExtra() throws Exception
    Throws:
      `Exception`

  - ### testSpecialFunctions

    @Test public void testSpecialFunctions() throws Exception
    Throws:
      `Exception`

  - ### testSpecialFunctions

    public void testSpecialFunctions(boolean hasRealEval, boolean hasCallback) throws Exception
    Throws:
      `Exception`

  - ### setShiftZeroElePfmc

    protected void setShiftZeroElePfmc()