123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
-
- import static org.junit.Assert.*;
- import org.junit.Test;
- import org.junit.Assert;
-
- /**
- * The test class BasicMathTest.
- *
- * @author (your name)
- * @version (a version number or a date)
- */
- public class BasicMathTest
- {
- @Test
- public void CalculatorTest()
- { //expected plug delta
- Assert.assertEquals(100.1, BasicMath.add(99.1,1.0), 2.00);
- }
- @Test
- public void testSubtract(){
- Assert.assertEquals(0.0, BasicMath.Subtract(1.0, 1.0), 0.00);
- }
- @Test
- public void testmultiply(){
- Assert.assertEquals(4.0, BasicMath.multiply(2.0, 2.0), 2.00);
- }
- @Test
- public void testdivide(){
- Assert.assertEquals(7.0, BasicMath.divide(14.0, 2.0), 7.00);
- }
- @Test
- public void testpower(){
- Assert.assertEquals(1.0, BasicMath.power(1.0, 1.0), 0.00);
- }
- @Test
- public void testsquareRoot(){
- Assert.assertEquals(3.0, BasicMath.squareRoot(9.00) , 9.00);
- }
- @Test
- public void testinverse(){
- Assert.assertEquals(0.5, BasicMath.inverse(2.00) , 00.5);
- }
- }
-
|