예제 #1
0
 @Test
 public void divisionByZeroShouldGiveInfinity() {
   ExpressionResolver resolver = new ExpressionResolver();
   ExpressionResolver spy = spy(resolver);
   Double result = spy.solveSimpleTerm(new Double(1), new Double(0), "DIV");
   assertEquals(result, new Double(POSITIVE_INFINITY));
 }
예제 #2
0
 @Test
 public void multiplicationIfNegativesShouldBeCorrect() {
   ExpressionResolver resolver = new ExpressionResolver();
   ExpressionResolver spy = spy(resolver);
   Double result = spy.solveSimpleTerm(new Double(1), new Double(-2), "MUL");
   assertEquals(result, new Double(-2));
 }
예제 #3
0
 @Test
 public void divisionOfNegativesShouldBeCorrect() {
   ExpressionResolver resolver = new ExpressionResolver();
   ExpressionResolver spy = spy(resolver);
   Double result = spy.solveSimpleTerm(new Double(-1), new Double(2), "DIV");
   assertEquals(result, new Double(-0.5));
 }