TrigonometryTest.java 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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 TrigonometryTest.
  7. *
  8. * @author (your name)
  9. * @version (a version number or a date)
  10. */
  11. public class TrigonometryTest
  12. {
  13. /**
  14. * Default constructor for test class TrigonometryTest
  15. */
  16. public TrigonometryTest()
  17. {
  18. }
  19. /**
  20. * Sets up the test fixture.
  21. *
  22. * Called before every test case method.
  23. */
  24. @Before
  25. public void setUp()
  26. {
  27. }
  28. /**
  29. * Tears down the test fixture.
  30. *
  31. * Called after every test case method.
  32. */
  33. @After
  34. public void tearDown()
  35. {
  36. }
  37. @Test
  38. public void TanTrigTest()
  39. {
  40. assertEquals(-0.5872139151569291, Trigonometry.tan(100), 0.1);
  41. }
  42. @Test
  43. public void CosTrigTest()
  44. {
  45. assertEquals(0.8623188722876839, Trigonometry.cos(100), 0.1);
  46. }
  47. @Test
  48. public void ATanTrigTest()
  49. {
  50. assertEquals(1.5607966601082315, Trigonometry.tanInverse(100), 0.1);
  51. }
  52. @Test
  53. public void ACosTrigTest()
  54. {
  55. assertEquals(3.141592653589793, Trigonometry.cosInverse(-1), 0.1);
  56. }
  57. @Test
  58. public void ASinTrigTest()
  59. {
  60. assertEquals(-1.5707963267948966, Trigonometry.sinInverse(-1), 0.1);
  61. }
  62. }