ScientificCalculationsTest.java 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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 ScientificCalculationsTest.
  7. *
  8. * @author (your name)
  9. * @version (a version number or a date)
  10. */
  11. public class ScientificCalculationsTest
  12. {
  13. @Test
  14. public void testSine()
  15. {
  16. ScientificCalculations scientif1 = new ScientificCalculations(3);
  17. assertEquals(0.1411200080598672, scientif1.sine(), 0.1);
  18. }
  19. @Test
  20. public void testCosine()
  21. {
  22. ScientificCalculations scientif1 = new ScientificCalculations(6);
  23. assertEquals(0.9601702866503661, scientif1.cosine(), 0.1);
  24. }
  25. @Test
  26. public void testTangent()
  27. {
  28. ScientificCalculations scientif1 = new ScientificCalculations(7);
  29. assertEquals(0.8714479827243187, scientif1.tangent(), 0.1);
  30. }
  31. @Test
  32. public void testInverseSine()
  33. {
  34. ScientificCalculations scientif1 = new ScientificCalculations(-1);
  35. assertEquals(-1.5707963267948966, scientif1.inverseSine(), 0.1);
  36. }
  37. @Test
  38. public void testInverseCosine()
  39. {
  40. ScientificCalculations scientif1 = new ScientificCalculations(-1);
  41. assertEquals(3.141592653589793, scientif1.inverseCosine(), 0.1);
  42. }
  43. @Test
  44. public void testInverseTangent()
  45. {
  46. ScientificCalculations scientif1 = new ScientificCalculations(-1);
  47. assertEquals(-0.7853981633974483, scientif1.inverseTangent(), 0.1);
  48. }
  49. @Test
  50. public void testFactorial()
  51. {
  52. ScientificCalculations scientif1 = new ScientificCalculations(5);
  53. assertEquals(120, scientif1.factorial(), 0.1);
  54. }
  55. }