ScientificOperationsTest.java 2.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. import static org.junit.Assert.*;
  2. import org.junit.After;
  3. import org.junit.Before;
  4. import org.junit.Test;
  5. /**
  6. * The test class ScientificOperationsTest.
  7. *
  8. * @author (your name)
  9. * @version (a version number or a date)
  10. */
  11. public class ScientificOperationsTest
  12. {
  13. ScientificOperations soObject = new ScientificOperations ();
  14. /**
  15. * Sets up the test fixture.
  16. *
  17. * Called before every test case method.
  18. */
  19. @Test
  20. public void sine()
  21. { double expected = 1.0;
  22. double actual = soObject.sine(90.0);
  23. double delta = 1.0;
  24. assertEquals(actual, expected, delta);
  25. }
  26. @Test
  27. public void cosine()
  28. { double expected = 1.0;
  29. double actual = soObject.cosine(0.0);
  30. double delta = 1.0;
  31. assertEquals(actual, expected, delta);
  32. }
  33. @Test
  34. public void invCosine()
  35. { double expected = 0.0;
  36. double actual = soObject.invCosine(1.0);
  37. double delta = 0.0;
  38. assertEquals(actual, expected, delta);
  39. }
  40. @Test
  41. public void invSine()
  42. { double expected = 0.0;
  43. double actual = soObject.invSine(0.0);
  44. double delta = 0.0;
  45. assertEquals(actual, expected, delta);
  46. }
  47. @Test
  48. public void tangent()
  49. { double expected = 0.0;
  50. double actual = soObject.tangent(0.0);
  51. double delta = 0.0;
  52. assertEquals(actual, expected, delta);
  53. }
  54. @Test
  55. public void invTangent()
  56. { double expected = 0.0;
  57. double actual = soObject.invTangent(0.0);
  58. double delta = 0.0;
  59. assertEquals(actual, expected, delta);
  60. }
  61. @Test
  62. public void log()
  63. { double expected = 0.0;
  64. double actual = soObject.log(1.0);
  65. double delta = 0.0;
  66. assertEquals(actual, expected, delta);
  67. }
  68. @Test
  69. public void log10()
  70. { double expected = 0.0;
  71. double actual = soObject.log10(1.0);
  72. double delta = 0.0;
  73. assertEquals(actual, expected, delta);
  74. }
  75. @Test
  76. public void square()
  77. { double expected = 4.0;
  78. double actual = soObject.square(2.0);
  79. double delta = 4.0;
  80. assertEquals(actual, expected, delta);
  81. }
  82. @Test
  83. public void squareRoot()
  84. { double expected = 5.0;
  85. double actual = soObject.squareRoot(25.0);
  86. double delta = 5.0;
  87. assertEquals(actual, expected, delta);
  88. }
  89. @Test
  90. public void degree()
  91. { double expected = 0.0;
  92. double actual = soObject.degree(0.0);
  93. double delta = 0.0;
  94. assertEquals(actual, expected, delta);
  95. }
  96. @Test
  97. public void radian()
  98. { double expected = 0.0;
  99. double actual = soObject.sine(0.0);
  100. double delta = 0.0;
  101. assertEquals(actual, expected, delta);
  102. }
  103. }