Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import junit.framework.TestCase;
- public class EvenSumTest extends TestCase {
- public void tests() {
- assertEquals(0, EvenSum.sumOfEvenNumbersUpTo(-100));
- assertEquals(0, EvenSum.sumOfEvenNumbersUpTo(-1));
- assertEquals(0, EvenSum.sumOfEvenNumbersUpTo(0));
- assertEquals(0, EvenSum.sumOfEvenNumbersUpTo(1));
- assertEquals(2, EvenSum.sumOfEvenNumbersUpTo(2));
- assertEquals(2, EvenSum.sumOfEvenNumbersUpTo(3));
- assertEquals(6, EvenSum.sumOfEvenNumbersUpTo(4));
- assertEquals(6, EvenSum.sumOfEvenNumbersUpTo(5));
- assertEquals(12, EvenSum.sumOfEvenNumbersUpTo(6));
- assertEquals(12, EvenSum.sumOfEvenNumbersUpTo(7));
- assertEquals(20, EvenSum.sumOfEvenNumbersUpTo(8));
- assertEquals(20, EvenSum.sumOfEvenNumbersUpTo(9));
- assertEquals(30, EvenSum.sumOfEvenNumbersUpTo(10));
- assertEquals(30, EvenSum.sumOfEvenNumbersUpTo(11));
- assertEquals(42, EvenSum.sumOfEvenNumbersUpTo(12));
- assertEquals(42, EvenSum.sumOfEvenNumbersUpTo(13));
- assertEquals(56, EvenSum.sumOfEvenNumbersUpTo(14));
- assertEquals(56, EvenSum.sumOfEvenNumbersUpTo(15));
- assertEquals(72, EvenSum.sumOfEvenNumbersUpTo(16));
- assertEquals(72, EvenSum.sumOfEvenNumbersUpTo(17));
- assertEquals(90, EvenSum.sumOfEvenNumbersUpTo(18));
- assertEquals(90, EvenSum.sumOfEvenNumbersUpTo(19));
- assertEquals(110, EvenSum.sumOfEvenNumbersUpTo(20));
- }
- public void testsB() {
- assertEquals(0, EvenSum.sumOfEvenNumbersUpToB(-100));
- assertEquals(0, EvenSum.sumOfEvenNumbersUpToB(-1));
- assertEquals(0, EvenSum.sumOfEvenNumbersUpToB(0));
- assertEquals(0, EvenSum.sumOfEvenNumbersUpToB(1));
- assertEquals(2, EvenSum.sumOfEvenNumbersUpToB(2));
- assertEquals(2, EvenSum.sumOfEvenNumbersUpToB(3));
- assertEquals(6, EvenSum.sumOfEvenNumbersUpToB(4));
- assertEquals(6, EvenSum.sumOfEvenNumbersUpToB(5));
- assertEquals(12, EvenSum.sumOfEvenNumbersUpToB(6));
- assertEquals(12, EvenSum.sumOfEvenNumbersUpToB(7));
- assertEquals(20, EvenSum.sumOfEvenNumbersUpToB(8));
- assertEquals(20, EvenSum.sumOfEvenNumbersUpToB(9));
- assertEquals(30, EvenSum.sumOfEvenNumbersUpToB(10));
- assertEquals(30, EvenSum.sumOfEvenNumbersUpToB(11));
- assertEquals(42, EvenSum.sumOfEvenNumbersUpToB(12));
- assertEquals(42, EvenSum.sumOfEvenNumbersUpToB(13));
- assertEquals(56, EvenSum.sumOfEvenNumbersUpToB(14));
- assertEquals(56, EvenSum.sumOfEvenNumbersUpToB(15));
- assertEquals(72, EvenSum.sumOfEvenNumbersUpToB(16));
- assertEquals(72, EvenSum.sumOfEvenNumbersUpToB(17));
- assertEquals(90, EvenSum.sumOfEvenNumbersUpToB(18));
- assertEquals(90, EvenSum.sumOfEvenNumbersUpToB(19));
- assertEquals(110, EvenSum.sumOfEvenNumbersUpToB(20));
- }
- }
Add Comment
Please, Sign In to add comment