Exemplo n.º 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));
 }
Exemplo n.º 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));
 }
Exemplo n.º 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));
 }