import static org.junit.Assert.*; import org.junit.After; import org.junit.Before; import org.junit.Test; /** * The test class MathMethodsTest. * * @author (your name) * @version (a version number or a date) */ public class MathMethodsTest { /** * Default constructor for test class MathMethodsTest */ public MathMethodsTest() { } /** * 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 testSquareRoot() { assertEquals(16.0, MathMethods.squareRoot(256), 0.1); } @Test public void testInvertPositive() { assertEquals(-5.0, MathMethods.invert(5), 0.1); } @Test public void testInvertNegative() { assertEquals(11.0, MathMethods.invert(-11), 0.1); } @Test public void testSin() { assertEquals(-0.26237485370392877, MathMethods.sin(50), 0.1); } @Test public void testDegToRad() { assertEquals(0.3490658503988659, MathMethods.degToRad(20), 0.1); } @Test public void testRadToDeg() { assertEquals(57.2957791308232, MathMethods.radToDeg(1), 0.1); } // @Test // public void testOctalDisplay() // { // MathMethods mathMethods1 = new MathMethods(); // mathMethods1.memory = 20; // assertEquals("0 24", MathMethods.switchDisplayMode("octal")); // } @Test public void testInverseSine() { assertEquals(1.5707963267948966, MathMethods.iSin(1), 0.1); } public void squareTest() { assertEquals(16, MathMethods.square(4), 0.1); } @Test public void tangentTest() { assertEquals(-3.380515005246586, MathMethods.tangent(5), 0.1); } @Test public void inverseTangentTest() { assertEquals(1.550798992821746, MathMethods.iTan(50), 0.1); } @Test public void inverseTest() { assertEquals(.1, MathMethods.inverse(10), 0.1); } }