1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
-
-
- import static org.junit.Assert.*;
- import org.junit.After;
- import org.junit.Before;
- import org.junit.Test;
-
- /**
- * The test class calculatorCoreFunctionsTest.
- *
- * @author (your name)
- * @version (a version number or a date)
- */
- import static org.junit.Assert.*;
- import org.junit.After;
- import org.junit.Before;
- import org.junit.Test;
-
- /**
- * The test class calculatorCoreFunctionsTest.
- *
- * @author (your name)
- * @version (a version number or a date)
- */
- public class calculatorCoreFunctionsTest
- {
- public calculatorCoreFunctions coreFunctions;
-
-
- @Before
- public void setUp()
- {
- coreFunctions = new calculatorCoreFunctions();
- }
-
- @After
- public void tearDown()
- {
- }
-
- @Test
- public void addTest()
- {
- double expected = 9.0;
- double actual = coreFunctions.add(8,1);
- assertEquals(expected, actual, 0.1);
-
- }
-
- @Test
- public void subtractTest()
- {
- double expected = 5.0;
- double actual = coreFunctions.subtract(7,2);
- assertEquals(expected, actual, 0.1);
- }
-
- @Test
- public void multiplyTest()
- {
- double expected = 12.0;
- double actual = coreFunctions.multiply(3,4);
- assertEquals(expected, actual, 0.1);
- }
-
- @Test
- public void divideTest()
- {
- double expected = 7.0;
- double actual = coreFunctions.divide(21,3);
- assertEquals(expected, actual, 0.1);
- }
-
- @Test
- public void expTest()
- {
- double expected = 4.0;
- double actual = coreFunctions.exponent(2,2);
- assertEquals(expected, actual, 0.1);
- }
-
- @Test
- public void sqrtTest()
- {
- double expected = 5.0;
- double actual = coreFunctions.sqrt(25.0);
- assertEquals(expected, actual, 0.1);
- }
-
- @Test
- public void invertTest()
- {
- double expected = 0.2;
- double actual = coreFunctions.inverse(5.0);
- assertEquals(expected, actual, 0.1);
- }
- }
|