-
Notifications
You must be signed in to change notification settings - Fork 0
/
Day21KtTest.kt
42 lines (35 loc) · 1.43 KB
/
Day21KtTest.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package aoc2017.day21
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Test
internal class Day21KtTest {
private val input = parseInput("src/main/kotlin/aoc2017/day21/input")
private val testInput = parseInput("src/main/kotlin/aoc2017/day21/testInput")
@Test
fun testFindAlternativePatterns() {
val allPatterns = setOf(
".#./..#/###", ".#./#../###", "#../#.#/##.", "..#/#.#/.##",
"###/#../.#.", "###/..#/.#.", ".##/#.#/..#", "##./#.#/#.."
)
assertEquals(allPatterns, findAlternativePatterns(".#./..#/###") )
}
@Test
fun testRotatePatternRight() {
assertEquals("#../#.#/##.", rotatePatternRight(".#./..#/###"))
assertEquals("###/#../.#.", rotatePatternRight("#../#.#/##."))
assertEquals(".##/#.#/..#", rotatePatternRight("###/#../.#."))
assertEquals(".#./..#/###", rotatePatternRight(".##/#.#/..#"))
}
@Test
fun testFlipPattern() {
assertEquals(".#./#../###", flipPattern(".#./..#/###"))
assertEquals("..#/#.#/##.", flipPattern("#../#.#/.##"))
assertEquals("###/..#/.#.", flipPattern("###/#../.#."))
assertEquals("##./#.#/#..", flipPattern(".##/#.#/..#"))
}
@Test
fun testEnhanceString() {
assertEquals(12, enhanceString(testInput, 2))
assertEquals(136, enhanceString(input, 5))
assertEquals(1911767, enhanceString(input, 18))
}
}