ShortCalculatorTest.java 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. import org.junit.Assert;
  2. import org.junit.Test;
  3. public class ShortCalculatorTest
  4. {
  5. ShortCalculator test = new ShortCalculator();
  6. @Test
  7. public void sumTest(){
  8. short expected = (short)131070;
  9. short actual = test.sum((short)65535,(short)65535);
  10. Assert.assertEquals(expected,actual);
  11. }
  12. @Test
  13. public void differenceTest(){
  14. short expected = 679;
  15. short actual = test.difference((short)700,(short)21);
  16. Assert.assertEquals(expected,actual);
  17. }
  18. @Test
  19. public void productTest(){
  20. short expected = 6000;
  21. short actual = test.product((short)200,(short)30);
  22. Assert.assertEquals(expected,actual);
  23. }
  24. @Test
  25. public void quotientTest(){
  26. short expected = 600;
  27. short actual = test.quotient((short)18000,(short)30);
  28. Assert.assertEquals(expected,actual);
  29. }
  30. @Test
  31. public void remainderTest(){
  32. short expected = 1;
  33. short actual = test.remainder((short)18001,(short)18000);
  34. Assert.assertEquals(expected,actual);
  35. }
  36. }