Ejemplo n.º 1
0
  @Test
  public void testSquareRoot() {
    final double DELTA = 1e-15;
    a = 0;
    double result = calculator.squareRoot(a);
    Assert.assertEquals(Math.sqrt(a), result, DELTA);

    a = 1;
    result = calculator.squareRoot(a);
    Assert.assertEquals(Math.sqrt(a), result, DELTA);

    a = 25;
    result = calculator.squareRoot(a);
    Assert.assertEquals(Math.sqrt(a), result, DELTA);

    a = 1544646;
    result = calculator.squareRoot(a);
    Assert.assertEquals(Math.sqrt(a), result, DELTA);
  }
Ejemplo n.º 2
0
 @Test
 public void testSquareRootWithNegativeNumber() {
   a = -26665;
   Double result = calculator.squareRoot(a);
   Assert.assertNull(result);
 }