1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import org.junit.Assert;
  2. import org.junit.Test;
  3. /**
  4. * The test class CoreFunctionsTest.
  5. *
  6. * @author (your name)
  7. * @version (a version number or a date)
  8. */
  9. public class CoreFunctionsTest
  10. { CoreFunctions coreFunctionsTest = new CoreFunctions();
  11. /**
  12. * Default constructor for test class CoreFunctionsTest
  13. */
  14. public CoreFunctionsTest()
  15. {
  16. }
  17. @Test
  18. public void testAdd(){
  19. double actual = CoreFunctions.add(1,2);
  20. double expected = 3;
  21. Assert.assertEquals(expected,actual,1e-8);
  22. }
  23. @Test
  24. public void testSubtract(){
  25. double actual = CoreFunctions.subtract(2,1);
  26. double expected = 1;
  27. Assert.assertEquals(expected,actual,1e-8);
  28. }
  29. @Test
  30. public void testMultiply(){
  31. double actual = CoreFunctions.multiply(2,1);
  32. double expected = 2;
  33. Assert.assertEquals(expected,actual,1e-8);
  34. }
  35. @Test
  36. public void testDivide(){
  37. double actual = CoreFunctions.multiply(2,1);
  38. double expected = 2;
  39. Assert.assertEquals(expected,actual,1e-8);
  40. }
  41. @Test
  42. public void vtestExp(){
  43. double actual = CoreFunctions.exp(2, 2);
  44. double expected = 4;
  45. Assert.assertEquals(expected,actual,1e-8);
  46. }
  47. }