|
| 1 | +package g0001_0100.s0017_letter_combinations_of_a_phone_number |
| 2 | + |
| 3 | +import org.hamcrest.CoreMatchers |
| 4 | +import org.hamcrest.MatcherAssert |
| 5 | +import org.junit.jupiter.api.Test |
| 6 | +import java.util.Arrays |
| 7 | + |
| 8 | +internal class SolutionTest { |
| 9 | + @Test |
| 10 | + fun letterCombinations() { |
| 11 | + MatcherAssert.assertThat( |
| 12 | + Solution().letterCombinations("23"), |
| 13 | + CoreMatchers.equalTo(Arrays.asList("ad", "ae", "af", "bd", "be", "bf", "cd", "ce", "cf")) |
| 14 | + ) |
| 15 | + } |
| 16 | + |
| 17 | + @Test |
| 18 | + fun letterCombinations2() { |
| 19 | + MatcherAssert.assertThat(Solution().letterCombinations(""), CoreMatchers.equalTo(Arrays.asList<Any>())) |
| 20 | + } |
| 21 | + |
| 22 | + @Test |
| 23 | + fun letterCombinations3() { |
| 24 | + MatcherAssert.assertThat(Solution().letterCombinations("2"), CoreMatchers.equalTo(Arrays.asList("a", "b", "c"))) |
| 25 | + } |
| 26 | + |
| 27 | + @Test |
| 28 | + fun letterCombinations4() { |
| 29 | + MatcherAssert.assertThat(Solution().letterCombinations("4"), CoreMatchers.equalTo(Arrays.asList("g", "h", "i"))) |
| 30 | + } |
| 31 | + |
| 32 | + @Test |
| 33 | + fun letterCombinations5() { |
| 34 | + MatcherAssert.assertThat(Solution().letterCombinations("5"), CoreMatchers.equalTo(Arrays.asList("j", "k", "l"))) |
| 35 | + } |
| 36 | + |
| 37 | + @Test |
| 38 | + fun letterCombinations6() { |
| 39 | + MatcherAssert.assertThat(Solution().letterCombinations("6"), CoreMatchers.equalTo(Arrays.asList("m", "n", "o"))) |
| 40 | + } |
| 41 | + |
| 42 | + @Test |
| 43 | + fun letterCombinations7() { |
| 44 | + MatcherAssert.assertThat( |
| 45 | + Solution().letterCombinations("7"), CoreMatchers.equalTo(Arrays.asList("p", "q", "r", "s")) |
| 46 | + ) |
| 47 | + } |
| 48 | + |
| 49 | + @Test |
| 50 | + fun letterCombinations8() { |
| 51 | + MatcherAssert.assertThat(Solution().letterCombinations("8"), CoreMatchers.equalTo(Arrays.asList("t", "u", "v"))) |
| 52 | + } |
| 53 | + |
| 54 | + @Test |
| 55 | + fun letterCombinations9() { |
| 56 | + MatcherAssert.assertThat( |
| 57 | + Solution().letterCombinations("9"), CoreMatchers.equalTo(Arrays.asList("w", "x", "y", "z")) |
| 58 | + ) |
| 59 | + } |
| 60 | +} |
0 commit comments