123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
-
- 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);
-
- }
- }
-
-
|