BasicMathTest.java 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import static org.junit.Assert.*;
  2. import org.junit.Test;
  3. import org.junit.Assert;
  4. /**
  5. * The test class BasicMathTest.
  6. *
  7. * @author (your name)
  8. * @version (a version number or a date)
  9. */
  10. public class BasicMathTest
  11. {
  12. @Test
  13. public void CalculatorTest()
  14. { //expected plug delta
  15. Assert.assertEquals(100.1, BasicMath.add(99.1,1.0), 2.00);
  16. }
  17. @Test
  18. public void testSubtract(){
  19. Assert.assertEquals(0.0, BasicMath.Subtract(1.0, 1.0), 0.00);
  20. }
  21. @Test
  22. public void testmultiply(){
  23. Assert.assertEquals(4.0, BasicMath.multiply(2.0, 2.0), 2.00);
  24. }
  25. @Test
  26. public void testdivide(){
  27. Assert.assertEquals(7.0, BasicMath.divide(14.0, 2.0), 7.00);
  28. }
  29. @Test
  30. public void testpower(){
  31. Assert.assertEquals(1.0, BasicMath.power(1.0, 1.0), 0.00);
  32. }
  33. @Test
  34. public void testsquareRoot(){
  35. Assert.assertEquals(3.0, BasicMath.squareRoot(9.00) , 9.00);
  36. }
  37. @Test
  38. public void testinverse(){
  39. Assert.assertEquals(0.5, BasicMath.inverse(2.00) , 00.5);
  40. }
  41. }