-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDay15KtTest.kt
36 lines (28 loc) · 1.15 KB
/
Day15KtTest.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
package aoc2017.day15
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.Assertions.*
internal class Day15KtTest {
private val generatorAStart = 634L
private val generatorBStart = 301L
@Test
fun testComputeNextNumber() {
assertEquals(1181022009, computeNextNumber(1092455, Generator.A))
assertEquals(137874439, computeNextNumber(1431495498, Generator.B))
}
@Test
fun testFindRightMost16BinaryRepresentation() {
assertEquals("1010101101100111", genRightmost16BinRepresentation(1092455))
assertEquals("1110001101001010", genRightmost16BinRepresentation(1431495498))
assertEquals("1110001101001010", genRightmost16BinRepresentation(1431495498 - 65536))
}
@Test
fun testCompareGeneratorValues() {
assertEquals(588, compareGeneratorValues(1092455, 430625591))
assertEquals(573, compareGeneratorValues(generatorAStart, generatorBStart))
}
@Test
fun testCompareGeneratorValuesPart2() {
assertEquals(309, compareGeneratorValuesPart2(1352636452, 1233683848))
assertEquals(294, compareGeneratorValuesPart2(generatorAStart, generatorBStart))
}
}