import static org.junit.Assert.*; import org.junit.After; import org.junit.Before; import org.junit.Test; /** * The test class simpleOpTest. * * @author (your name) * @version (a version number or a date) */ public class simpleOpTest { /** * Default constructor for test class simpleOpTest */ public simpleOpTest() { } /** * Sets up the test fixture. * * Called before every test case method. */ @Before public void setUp() { } /** * Tears down the test fixture. * * Called after every test case method. */ @After public void tearDown() { } @Test public void firstAddTest() { assertEquals(4.0, simpleOp.add(2, 2), 0.1); } @Test public void secondAddTestNegative() { assertEquals(-8.0, simpleOp.add(-100, 92), 0.1); } @Test public void firstSubtractTest() { assertEquals(13.0, simpleOp.sub(25, 12), 0.1); } @Test public void secondSubtractTestNegative() { assertEquals(-8.0, simpleOp.sub(-100, -92), 0.1); } @Test public void firstMultiplyTest() { assertEquals(0.0, simpleOp.mul(3, 0), 0.1); } @Test public void secondMultiplyTestNegative() { assertEquals(125.0, simpleOp.mul(-25, -5), 0.1); } @Test public void DivideTest2Negative() { assertEquals(20.0, simpleOp.div(100, 5), 0.1); } @Test public void firstSquareTest() { assertEquals(25.0, simpleOp.squ(5), 0.1); } @Test public void secondSquareTestNegative() { assertEquals(49.0, simpleOp.squ(-7), 0.1); } @Test public void firstExponentTest() { assertEquals(125.0, simpleOp.exp(5, 3), 0.1); } @Test public void SecondExponentTestNegative() { assertEquals(0.008, simpleOp.exp(5, -3), 0.1); } @Test public void firstInverseTest() { assertEquals(0.01, simpleOp.inv(100), 0.1); } @Test public void secondInverseTest() { assertEquals(0.0002, simpleOp.inv(5000), 0.1); } @Test public void divideByZero() { assertEquals(0.0, simpleOp.div(100, 0), 0.1); } @Test public void firstInvertTest() { assertEquals(-237.0, simpleOp.invert(237), 0.1); } @Test public void secondInvertTest() { assertEquals(253.0, simpleOp.invert(-253), 0.1); } }