-
Notifications
You must be signed in to change notification settings - Fork 0
/
Day5KtTest.kt
53 lines (45 loc) · 1.62 KB
/
Day5KtTest.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
43
44
45
46
47
48
49
50
51
52
53
package aoc2018.day05
import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
import java.util.*
class Day5KtTest {
@Test
fun test_compute_alchemical_reduction() {
val input = readInputFile("src/main/kotlin/aoc2018/day05/in1")
Assertions.assertEquals("dabCBAcaDA", computeAlchemicalReduction(input))
}
@Test
fun test_compute_alchemical_reduction_length() {
val input = readInputFile("src/main/kotlin/aoc2018/day05/in1")
Assertions.assertEquals(10, computeAlchemicalReductionLength(input))
}
@Test
fun test_compute_alchemical_reduction_2() {
val input = readInputFile("src/main/kotlin/aoc2018/day05/in2")
Assertions.assertEquals(10638, computeAlchemicalReductionLength(input))
}
@Test
fun test_compute_alchemical_reduction_3() {
val input = readInputFile("src/main/kotlin/aoc2018/day05/in3")
Assertions.assertEquals("yj", computeAlchemicalReduction(input))
}
@Test
fun test_char_remove_at() {
Assertions.assertEquals("mara", charRemoveAt("marta", 3))
}
@Test
fun test_remove_all_letter() {
Assertions.assertEquals("dabCBAcaDA", removeAllLetter("daFbCBfAcaFfDA", "f"))
}
@Test
fun test_compute_minimum_alchemical_reduction() {
val input = readInputFile("src/main/kotlin/aoc2018/day05/in2")
val results: MutableList<Int> = ArrayList()
var letter = 'a'
while (letter <= 'z') {
results.add(computeAlchemicalReductionLength(removeAllLetter(input, letter.toString() + "")))
letter++
}
println(results)
}
}