JeffGrigg

HomeworkMathTest

May 28th, 2017
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 0.71 KB | None | 0 0
  1. import junit.framework.TestCase;
  2.  
  3. public class HomeworkMathTest extends TestCase {
  4.  
  5.     public void testHomeworkExample() {
  6.         assertEquals(85, HomeworkMath.sumOfSumsOfDigitsInCyclicOrder(582109));
  7.     }
  8.  
  9.     public void testZero() {
  10.         assertEquals(0, HomeworkMath.sumOfSumsOfDigitsInCyclicOrder(0));
  11.     }
  12.  
  13.     public void testOneDigit() {
  14.         assertEquals(7, HomeworkMath.sumOfSumsOfDigitsInCyclicOrder(7));
  15.     }
  16.  
  17.     public void testTwoDigits() {
  18.         assertEquals((1 + 3) + (3), HomeworkMath.sumOfSumsOfDigitsInCyclicOrder(13));
  19.     }
  20.  
  21.     public void testThreeDigits() {
  22.         assertEquals((1 + 2 + 3) + (2 + 3) + (3), HomeworkMath.sumOfSumsOfDigitsInCyclicOrder(123));
  23.     }
  24.  
  25. }
Add Comment
Please, Sign In to add comment