scienticFunctionsTest.java 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. import org.junit.Assert;
  2. import org.junit.After;
  3. import org.junit.Before;
  4. import org.junit.Test;
  5. /**
  6. * The test class scienticFunctionsTest.
  7. *
  8. * @author (your name)
  9. * @version (a version number or a date)
  10. */
  11. public class scienticFunctionsTest
  12. {
  13. private scienticFunctions scientificFunctions;
  14. @Before
  15. public void setUp(){
  16. scientificFunctions = new scienticFunctions();
  17. }
  18. @Test
  19. public void sineTest(){
  20. // :Given
  21. Double expected = 0.0;
  22. // :When
  23. Double actual = scientificFunctions.sine(0.0);
  24. // :Then
  25. Assert.assertEquals(expected, actual);
  26. }
  27. @Test
  28. public void cosineTest(){
  29. // :Given
  30. Double expected = 1.0;
  31. // :When
  32. Double actual = scientificFunctions.cosine(0);
  33. // :Then
  34. Assert.assertEquals(expected, actual);
  35. }
  36. @Test
  37. public void tangentTest(){
  38. // :Given
  39. Double expected = 0.0;
  40. // :When
  41. Double actual = scientificFunctions.tangent(0);
  42. // :Then
  43. Assert.assertEquals(expected, actual);
  44. }
  45. @Test
  46. public void inverseTangentTest(){
  47. // :Given
  48. Double expected = 45.0;
  49. // :When
  50. Double actual = scientificFunctions.inverseTangent(1);
  51. // :Then
  52. Assert.assertEquals(expected, actual);
  53. }
  54. @Test
  55. public void inverseCosineTest(){
  56. // :Given
  57. Double expected = 90.0;
  58. // :When
  59. Double actual = scientificFunctions.inverseCosine(0.0);
  60. // :Then
  61. Assert.assertEquals(expected, actual);
  62. }
  63. @Test
  64. public void inverseSineTest(){
  65. // :Given
  66. Double expected = 0.0;
  67. // :When
  68. Double actual = scientificFunctions.inverseSine(0.0);
  69. // :Then
  70. Assert.assertEquals(expected, actual);
  71. }
  72. }