BonusFeaturesTest.java 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. import static org.junit.Assert.*;
  2. import org.junit.Test;
  3. import java.math.BigDecimal;
  4. /**
  5. * The test class BonusFeaturesTest.
  6. */
  7. public class BonusFeaturesTest
  8. {
  9. private Console console = new Console();
  10. private BonusFeatures bonus = new BonusFeatures(console);
  11. @Test
  12. public void factorialOfTest(){
  13. //Given
  14. Double test1 = 100.00;
  15. //When
  16. Double actual = (9.33262154439441E157);
  17. Double expected = bonus.factorialOf(test1);
  18. //Then
  19. assertEquals(expected,actual);
  20. }
  21. @Test
  22. public void logarithmTest(){
  23. //Given
  24. Double test1 = 10.00;
  25. //When
  26. double actual = 1.00;
  27. double expected = bonus.logarithm(test1);
  28. //Then
  29. assertEquals(expected,actual, 0);
  30. }
  31. @Test
  32. public void invLogarithmTest(){
  33. //Given
  34. Double test1 = 10.00;
  35. //When
  36. double actual = 10000000000.00;
  37. double expected = bonus.invLogarithm(test1);
  38. //Then
  39. assertEquals(expected,actual,0);
  40. }
  41. @Test
  42. public void lnLogarithmTest(){
  43. //Given
  44. Double test1 = Math.exp(1);
  45. //When
  46. double actual = 1;
  47. double expected = bonus.lnLogarithm(test1);
  48. //Then
  49. assertEquals(expected,actual, 0);
  50. }
  51. @Test
  52. public void expLogarithmTest(){
  53. //Given
  54. Double test1 = 0.00;
  55. //When
  56. double actual = 1;
  57. double expected = bonus.expLogarithm(test1);
  58. //Then
  59. assertEquals(expected,actual, 0);
  60. }
  61. }