ScientificTest.java 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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 ScientificTest.
  7. *
  8. * @author (your name)
  9. * @version (a version number or a date)
  10. */
  11. public class ScientificTest
  12. {
  13. private Scientific test;
  14. public ScientificTest(){
  15. }
  16. /**
  17. * Sets up the test fixture.
  18. *
  19. * Called before every test case method.
  20. */
  21. @Before
  22. public void setUp()
  23. {
  24. Scientific test = new Scientific();
  25. }
  26. /**
  27. * Tears down the test fixture.
  28. *
  29. * Called after every test case method.
  30. */
  31. @Test
  32. public void testSineDegrees()
  33. {
  34. //expected
  35. double expected = 1.0;
  36. //actual
  37. double actualSine = test.sine(90.0,0);
  38. //assertion
  39. assertEquals(expected, actualSine, 0.1);
  40. }
  41. @Test
  42. public void testSineRadians()
  43. {
  44. //expected
  45. double expected = 0.5;
  46. //actual
  47. double actualSine = test.sine(0.52359877559,1);
  48. //assertion
  49. assertEquals(expected, actualSine, 0.1);
  50. }
  51. }