JeffGrigg

EvenSumTest

Jun 15th, 2017
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 2.88 KB | None | 0 0
  1. import junit.framework.TestCase;
  2.  
  3. public class EvenSumTest extends TestCase {
  4.     public void tests() {
  5.         assertEquals(0, EvenSum.sumOfEvenNumbersUpTo(-100));
  6.         assertEquals(0, EvenSum.sumOfEvenNumbersUpTo(-1));
  7.         assertEquals(0, EvenSum.sumOfEvenNumbersUpTo(0));
  8.         assertEquals(0, EvenSum.sumOfEvenNumbersUpTo(1));
  9.         assertEquals(2, EvenSum.sumOfEvenNumbersUpTo(2));
  10.         assertEquals(2, EvenSum.sumOfEvenNumbersUpTo(3));
  11.         assertEquals(6, EvenSum.sumOfEvenNumbersUpTo(4));
  12.         assertEquals(6, EvenSum.sumOfEvenNumbersUpTo(5));
  13.         assertEquals(12, EvenSum.sumOfEvenNumbersUpTo(6));
  14.         assertEquals(12, EvenSum.sumOfEvenNumbersUpTo(7));
  15.         assertEquals(20, EvenSum.sumOfEvenNumbersUpTo(8));
  16.         assertEquals(20, EvenSum.sumOfEvenNumbersUpTo(9));
  17.         assertEquals(30, EvenSum.sumOfEvenNumbersUpTo(10));
  18.         assertEquals(30, EvenSum.sumOfEvenNumbersUpTo(11));
  19.         assertEquals(42, EvenSum.sumOfEvenNumbersUpTo(12));
  20.         assertEquals(42, EvenSum.sumOfEvenNumbersUpTo(13));
  21.         assertEquals(56, EvenSum.sumOfEvenNumbersUpTo(14));
  22.         assertEquals(56, EvenSum.sumOfEvenNumbersUpTo(15));
  23.         assertEquals(72, EvenSum.sumOfEvenNumbersUpTo(16));
  24.         assertEquals(72, EvenSum.sumOfEvenNumbersUpTo(17));
  25.         assertEquals(90, EvenSum.sumOfEvenNumbersUpTo(18));
  26.         assertEquals(90, EvenSum.sumOfEvenNumbersUpTo(19));
  27.         assertEquals(110, EvenSum.sumOfEvenNumbersUpTo(20));
  28.     }
  29.     public void testsB() {
  30.         assertEquals(0, EvenSum.sumOfEvenNumbersUpToB(-100));
  31.         assertEquals(0, EvenSum.sumOfEvenNumbersUpToB(-1));
  32.         assertEquals(0, EvenSum.sumOfEvenNumbersUpToB(0));
  33.         assertEquals(0, EvenSum.sumOfEvenNumbersUpToB(1));
  34.         assertEquals(2, EvenSum.sumOfEvenNumbersUpToB(2));
  35.         assertEquals(2, EvenSum.sumOfEvenNumbersUpToB(3));
  36.         assertEquals(6, EvenSum.sumOfEvenNumbersUpToB(4));
  37.         assertEquals(6, EvenSum.sumOfEvenNumbersUpToB(5));
  38.         assertEquals(12, EvenSum.sumOfEvenNumbersUpToB(6));
  39.         assertEquals(12, EvenSum.sumOfEvenNumbersUpToB(7));
  40.         assertEquals(20, EvenSum.sumOfEvenNumbersUpToB(8));
  41.         assertEquals(20, EvenSum.sumOfEvenNumbersUpToB(9));
  42.         assertEquals(30, EvenSum.sumOfEvenNumbersUpToB(10));
  43.         assertEquals(30, EvenSum.sumOfEvenNumbersUpToB(11));
  44.         assertEquals(42, EvenSum.sumOfEvenNumbersUpToB(12));
  45.         assertEquals(42, EvenSum.sumOfEvenNumbersUpToB(13));
  46.         assertEquals(56, EvenSum.sumOfEvenNumbersUpToB(14));
  47.         assertEquals(56, EvenSum.sumOfEvenNumbersUpToB(15));
  48.         assertEquals(72, EvenSum.sumOfEvenNumbersUpToB(16));
  49.         assertEquals(72, EvenSum.sumOfEvenNumbersUpToB(17));
  50.         assertEquals(90, EvenSum.sumOfEvenNumbersUpToB(18));
  51.         assertEquals(90, EvenSum.sumOfEvenNumbersUpToB(19));
  52.         assertEquals(110, EvenSum.sumOfEvenNumbersUpToB(20));
  53.     }
  54. }
Add Comment
Please, Sign In to add comment