public class EvaluatorTest extends Object
Modifier and Type | Field and Description |
---|---|
org.junit.rules.ExpectedException |
thrown |
Constructor and Description |
---|
EvaluatorTest() |
Modifier and Type | Method and Description |
---|---|
static int |
evaluate(AST ast)
Convenience method to evaluate the given
ast to an integer |
static int |
evaluateNoException(AST ast)
Similar to
evaluate , except an EvaluatorException
triggers a test failure. |
void |
testDivDirectZero() |
void |
testDivNonZero() |
void |
testLiteral() |
void |
testPlus() |
void |
testUnaryMinusLiteral() |
public static int evaluate(AST ast) throws EvaluatorException
ast
to an integerast
- the AST to be evaluatedEvaluatorException
- if the AST cannot be evaluatedpublic static int evaluateNoException(AST ast)
evaluate
, except an EvaluatorException
triggers a test failure. This lifts the burden of annotating tests which
are supposed to pass with the otherwise superfluous EvaluatorException
.ast
- The AST to be evaluatedpublic void testLiteral()
public void testPlus()
public void testDivNonZero()
public void testUnaryMinusLiteral()
public void testDivDirectZero() throws EvaluatorException
EvaluatorException