|
| 1 | +import org.junit.Assert; |
| 2 | +import org.junit.Test; |
| 3 | + |
| 4 | +/** |
| 5 | + * @author medany |
| 6 | + */ |
| 7 | + |
| 8 | +public class LonelyIntegerTest { |
| 9 | + |
| 10 | + @Test |
| 11 | + public void Test_1() { |
| 12 | + |
| 13 | + LonelyInteger alg = new LonelyInteger(); |
| 14 | + |
| 15 | + int actual = alg.solve(new int[] { 1, 1, 2 }), expected = 2; |
| 16 | + |
| 17 | + Assert.assertEquals(expected, actual); |
| 18 | + |
| 19 | + } |
| 20 | + |
| 21 | + @Test |
| 22 | + public void Test_2() { |
| 23 | + |
| 24 | + LonelyInteger alg = new LonelyInteger(); |
| 25 | + |
| 26 | + int actual = alg.solve(new int[] { 0, 0, 1, 2, 1 }), expected = 2; |
| 27 | + |
| 28 | + Assert.assertEquals(expected, actual); |
| 29 | + |
| 30 | + } |
| 31 | + |
| 32 | + @Test |
| 33 | + public void Test_3() { |
| 34 | + |
| 35 | + LonelyInteger alg = new LonelyInteger(); |
| 36 | + |
| 37 | + int actual = alg.solve(new int[] { 4, 9, 95, 93, 57, 4, 57, 93, 9 }), expected = 95; |
| 38 | + |
| 39 | + Assert.assertEquals(expected, actual); |
| 40 | + |
| 41 | + } |
| 42 | + |
| 43 | + @Test |
| 44 | + public void Test_4() { |
| 45 | + |
| 46 | + LonelyInteger alg = new LonelyInteger(); |
| 47 | + |
| 48 | + int actual = alg.solve(new int[] { 59, 88, 14, 8, 85, 1, 94, 74, 57, 96, 39, 2, 47, 43, 35, 17, 53, 52, 92, 31, |
| 49 | + 99, 48, 94, 30, 92, 60, 32, 45, 88, 13, 39, 50, 22, 65, 89, 46, 65, 76, 57, 67, 99, 35, 76, 46, 85, 82, |
| 50 | + 45, 62, 53, 80, 74, 22, 31, 52, 82, 13, 41, 96, 2, 1, 80, 62, 4, 20, 50, 89, 59, 67, 60, 8, 41, 14, 47, |
| 51 | + 48, 17, 4, 43, 30, 32 }), expected = 20; |
| 52 | + |
| 53 | + Assert.assertEquals(expected, actual); |
| 54 | + |
| 55 | + } |
| 56 | +} |
0 commit comments