[calculinum~subversion:2] Fixed test file
- From: joshis@kenai.com
- To: commits@calculinum.kenai.com
- Subject: [calculinum~subversion:2] Fixed test file
- Date: Sun, 6 Dec 2009 01:07:53 +0000
Project: calculinum
Repository: subversion
Revision: 2
Author: joshis
Date: 2009-12-06 01:07:51 UTC
Link:
Log Message:
------------
Fixed test file
Revisions:
----------
2
Modified Paths:
---------------
PreciseCalc/test/org/joshis/calc/api/CalculatorTest.java
Diffs:
------
Index: PreciseCalc/test/org/joshis/calc/api/CalculatorTest.java
===================================================================
--- PreciseCalc/test/org/joshis/calc/api/CalculatorTest.java (revision 1)
+++ PreciseCalc/test/org/joshis/calc/api/CalculatorTest.java (revision 2)
@@ -6,6 +6,7 @@
package org.joshis.calc.api;
import java.math.BigDecimal;
+import org.joshis.calc.impl.ExpressionEvaluationException;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
@@ -42,7 +43,7 @@
* Test of evaluate method, of class Calculator.
*/
@Test
- public void testEvaluate() {
+ public void testEvaluate() throws ExpressionEvaluationException {
System.out.println("evaluate");
String expr = "1+1+0.01";
int precision = 2;
@@ -130,7 +131,7 @@
try {
result = Calculator.evaluate(expr, precision);
fail("[(1+1] - unclosed bracket");
- } catch (IllegalStateException e) {
+ } catch (ExpressionEvaluationException e) {
}
expr = "(1+1))";
@@ -139,7 +140,7 @@
try {
result = Calculator.evaluate(expr, precision);
fail("[(1+1))] - too many closing brackets");
- } catch (IllegalStateException e) {
+ } catch (ExpressionEvaluationException e) {
}
expr = "(1+)1";
@@ -148,7 +149,7 @@
try {
result = Calculator.evaluate(expr, precision);
fail("[(1+)1] - incorrect position of the closing bracket");
- } catch (IllegalStateException e) {
+ } catch (ExpressionEvaluationException e) {
}
expr = "(1*)1";
@@ -157,7 +158,7 @@
try {
result = Calculator.evaluate(expr, precision);
fail("[(1*)1] - incorrect position of the closing bracket");
- } catch (IllegalStateException e) {
+ } catch (ExpressionEvaluationException e) {
}
expr = "(1+1";
@@ -166,7 +167,7 @@
try {
result = Calculator.evaluate(expr, precision);
fail("[(1+1] - unclosed bracket");
- } catch (IllegalStateException e) {
+ } catch (ExpressionEvaluationException e) {
}
expr = "(1+1 5";
@@ -175,7 +176,7 @@
try {
result = Calculator.evaluate(expr, precision);
fail("[(1+1 5] - number should not be here");
- } catch (IllegalStateException e) {
+ } catch (ExpressionEvaluationException e) {
}
expr = "(1+1(";
@@ -184,7 +185,7 @@
try {
result = Calculator.evaluate(expr, precision);
fail("[(1+1(] - unexpected opening bracket");
- } catch (IllegalStateException e) {
+ } catch (ExpressionEvaluationException e) {
}
expr = "(1+pokus)";
@@ -193,7 +194,7 @@
try {
result = Calculator.evaluate(expr, precision);
fail("[(1+pokus)] - unexpected tokens 'pokus'");
- } catch (IllegalStateException e) {
+ } catch (ExpressionEvaluationException e) {
}
expr = "(1+3,5)";
@@ -202,7 +203,7 @@
try {
result = Calculator.evaluate(expr, precision);
fail("[(1+3,5)] - token ','");
- } catch (IllegalStateException e) {
+ } catch (ExpressionEvaluationException e) {
}
expr = "0.0+0.0";
@@ -228,7 +229,7 @@
* Test that uses the expressions from the assesment for a brief
verification
*/
@Test
- public void testExaplesInAssesment() {
+ public void testExaplesInAssesment() throws
ExpressionEvaluationException {
System.out.println("example task");
String expr = "3+2";
int precision = 20;
@@ -287,7 +288,7 @@
try {
result = Calculator.evaluate(expr, precision);
fail("[3 ** 5] is not a valid expr.");
- } catch (IllegalStateException e) {
+ } catch (ExpressionEvaluationException e) {
}
expr = "last*3";
@@ -300,7 +301,7 @@
* Additional tests, quick evaluation of failing test case found during
testing
*/
@Test
- public void additionalCases() {
+ public void additionalCases() throws ExpressionEvaluationException {
System.out.println("Additional test cases");
String[][] expressionTests = { // add failing test cases to this
method
// { "EXPRESSION", "EXPECTED RESULT" }
|
[calculinum~subversion:2] Fixed test file |
joshis | 12/06/2009 |





