org.lsmp.djepJUnit
Class JepTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.lsmp.djepJUnit.JepTest
All Implemented Interfaces:
junit.framework.Test
Direct Known Subclasses:
VectorJepTest, XJepTest

public class JepTest
extends junit.framework.TestCase

Author:
Rich Morris Created on 19-Nov-2003

Field Summary
static boolean SHOW_BAD
           
 
Constructor Summary
JepTest(java.lang.String name)
           
 
Method Summary
 java.lang.Object calcValue(Node expr)
           
 java.lang.Object calcValue(java.lang.String expr)
          Parse and evaluate an expression.
 void complexValueTest(java.lang.String expr, Complex expected, double tol)
          Test parse-evaluate with complex number and given tollerence.
static void main(java.lang.String[] args)
          Main entry point.
 void myAssertEquals(java.lang.String msg, java.lang.Object expected, java.lang.Object actual)
          Assertion with message on command line.
 void myAssertNaN(java.lang.String msg, java.lang.Object actual)
           
protected  void setUp()
          Run before each test.
static junit.framework.Test suite()
          Create a test suite.
 void testAssign()
           
 void testAssign2()
           
 void testBad()
           
 void testBinom()
           
 void testComplex()
           
 void testDotInName()
           
 void testFunction()
           
 void testGood()
          just test JUnit working OK
 void testIf()
           
 void testLogical()
           
 void testNaN()
           
 void testNumParam()
           
 void testSimpleSum()
           
 void testUndeclared()
           
 void valueTest(java.lang.String expr, double a)
          Test parse and evaluate with with a Double result.
 void valueTest(java.lang.String expr, double a, double tol)
           
 void valueTest(java.lang.String expr, java.lang.Object expected)
          Test result j.evaluate(j.parse(expr))
 void valueTest(java.lang.String expr, java.lang.String expected)
           
 void valueTestInt(java.lang.String expr, int a)
          Test parse and evaluate which should give the result Integer(a).
 void valueTestNaN(java.lang.String expr)
           
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, name, run, run, runBare, runTest, setName, tearDown, toString
 
Methods inherited from class junit.framework.Assert
assert, assert, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertNotNull, assertNotNull, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SHOW_BAD

public static final boolean SHOW_BAD
See Also:
Constant Field Values
Constructor Detail

JepTest

public JepTest(java.lang.String name)
Method Detail

suite

public static junit.framework.Test suite()
Create a test suite.

Returns:
the TestSuite

main

public static void main(java.lang.String[] args)
Main entry point.

Parameters:
args -

setUp

protected void setUp()
Run before each test.

Overrides:
setUp in class junit.framework.TestCase

myAssertEquals

public void myAssertEquals(java.lang.String msg,
                           java.lang.Object expected,
                           java.lang.Object actual)
Assertion with message on command line.

Parameters:
msg - message to display
expected - expected result
actual - actual result

myAssertNaN

public void myAssertNaN(java.lang.String msg,
                        java.lang.Object actual)

calcValue

public java.lang.Object calcValue(java.lang.String expr)
                           throws ParseException
Parse and evaluate an expression.

Parameters:
expr - string to parse
Returns:
value after evaluate.
Throws:
ParseException

calcValue

public java.lang.Object calcValue(Node expr)
                           throws ParseException
Throws:
ParseException

valueTest

public void valueTest(java.lang.String expr,
                      java.lang.Object expected)
               throws java.lang.Exception
Test result j.evaluate(j.parse(expr))

Parameters:
expr - the expression to parse and evaluate
expected - result expected
Throws:
java.lang.Exception

valueTest

public void valueTest(java.lang.String expr,
                      java.lang.String expected)
               throws java.lang.Exception
Throws:
java.lang.Exception

valueTestNaN

public void valueTestNaN(java.lang.String expr)
                  throws java.lang.Exception
Throws:
java.lang.Exception

valueTestInt

public void valueTestInt(java.lang.String expr,
                         int a)
                  throws java.lang.Exception
Test parse and evaluate which should give the result Integer(a).

Parameters:
expr -
a - expected value will be converted to an Integer.
Throws:
java.lang.Exception

valueTest

public void valueTest(java.lang.String expr,
                      double a)
               throws java.lang.Exception
Test parse and evaluate with with a Double result.

Parameters:
expr -
a - expected value will be converted to a Double.
Throws:
java.lang.Exception

valueTest

public void valueTest(java.lang.String expr,
                      double a,
                      double tol)
               throws java.lang.Exception
Throws:
java.lang.Exception

complexValueTest

public void complexValueTest(java.lang.String expr,
                             Complex expected,
                             double tol)
                      throws java.lang.Exception
Test parse-evaluate with complex number and given tollerence.

Parameters:
expr -
expected -
tol -
Throws:
java.lang.Exception

testGood

public void testGood()
just test JUnit working OK


testSimpleSum

public void testSimpleSum()
                   throws java.lang.Exception
Throws:
java.lang.Exception

testLogical

public void testLogical()
                 throws java.lang.Exception
Throws:
java.lang.Exception

testFunction

public void testFunction()
                  throws java.lang.Exception
Throws:
java.lang.Exception

testComplex

public void testComplex()
                 throws java.lang.Exception
Throws:
java.lang.Exception

testIf

public void testIf()
            throws java.lang.Exception
Throws:
java.lang.Exception

testAssign

public void testAssign()
                throws java.lang.Exception
Throws:
java.lang.Exception

testDotInName

public void testDotInName()
                   throws ParseException,
                          java.lang.Exception
Throws:
ParseException
java.lang.Exception

testBinom

public void testBinom()
               throws ParseException,
                      java.lang.Exception
Throws:
ParseException
java.lang.Exception

testNaN

public void testNaN()
             throws java.lang.Exception
Throws:
java.lang.Exception

testAssign2

public void testAssign2()

testNumParam

public void testNumParam()
                  throws java.lang.Exception
Throws:
java.lang.Exception

testUndeclared

public void testUndeclared()
                    throws java.lang.Exception
Throws:
java.lang.Exception

testBad

public void testBad()
             throws java.lang.Exception
Throws:
java.lang.Exception


http://www.singularsys.com/jep Copyright © 2007 Singular Systems