1
|
|
package com.adventofcode.day05 |
2
|
|
|
3
|
|
import java.io.Serializable |
4
|
|
|
5
|
2
1. getMax : replaced int return with 0 for com/adventofcode/day05/BinarySpace::getMax → KILLED
2. getMin : replaced int return with 0 for com/adventofcode/day05/BinarySpace::getMin → KILLED
|
open class BinarySpace(val min: Int, val max: Int) : Serializable { |
6
|
|
|
7
|
|
override fun toString(): String { |
8
|
1
1. toString : replaced return value with "" for com/adventofcode/day05/BinarySpace::toString → KILLED
|
return "[$min,$max]" |
9
|
|
} |
10
|
|
|
11
|
|
fun decode(code: String): BinarySpace { |
12
|
|
var newSpace = this |
13
|
|
code.toCharArray() |
14
|
|
.forEach { |
15
|
|
newSpace = newSpace.takeHalf(it) |
16
|
1
1. decode : Changed increment from 1 to -1 → KILLED
|
} |
17
|
|
return newSpace |
18
|
|
|
19
|
|
} |
20
|
|
|
21
|
|
fun takeLowerHalf(): BinarySpace { |
22
|
1
1. takeLowerHalf : negated conditional → KILLED
|
if (min == max) return this |
23
|
1
1. takeLowerHalf : Replaced integer subtraction with addition → KILLED
|
return BinarySpace(min, max - Math.floorDiv(getSpaceDelta(), 2)) |
24
|
|
} |
25
|
|
|
26
|
|
fun takeUpperHalf(): BinarySpace { |
27
|
1
1. takeUpperHalf : negated conditional → KILLED
|
if (min == max) return this |
28
|
1
1. takeUpperHalf : Replaced integer addition with subtraction → KILLED
|
return BinarySpace(min + Math.floorDiv(getSpaceDelta(), 2), max) |
29
|
|
} |
30
|
|
|
31
|
|
private fun getSpaceDelta(): Int { |
32
|
1
1. getSpaceDelta : Replaced integer subtraction with addition → KILLED
|
val diff = max - min |
33
|
4
1. getSpaceDelta : Replaced integer modulus with multiplication → KILLED
2. getSpaceDelta : Replaced integer addition with subtraction → KILLED
3. getSpaceDelta : negated conditional → KILLED
4. getSpaceDelta : replaced int return with 0 for com/adventofcode/day05/BinarySpace::getSpaceDelta → KILLED
|
if (diff % 2 != 0) return diff + 2 |
34
|
1
1. getSpaceDelta : replaced int return with 0 for com/adventofcode/day05/BinarySpace::getSpaceDelta → KILLED
|
return diff |
35
|
|
} |
36
|
|
|
37
|
|
fun takeHalf(code: Char): BinarySpace { |
38
|
2
1. takeHalf : negated conditional → KILLED
2. takeHalf : negated conditional → KILLED
|
if (code == 'F' || code == 'L') return takeLowerHalf() |
39
|
|
return takeUpperHalf() |
40
|
|
} |
41
|
|
|
42
|
|
|
43
|
|
} |
| | Mutations |
5 |
|
1.1 Location : getMax Killed by : com.adventofcode.day05.BinarySpaceTest.[engine:junit-jupiter]/[class:com.adventofcode.day05.BinarySpaceTest]/[method:shouldDisplayNicely()] replaced int return with 0 for com/adventofcode/day05/BinarySpace::getMax → KILLED 2.2 Location : getMin Killed by : com.adventofcode.day05.BinarySpaceTest.[engine:junit-jupiter]/[class:com.adventofcode.day05.BinarySpaceTest]/[method:shouldDisplayNicely()] replaced int return with 0 for com/adventofcode/day05/BinarySpace::getMin → KILLED
|
8 |
|
1.1 Location : toString Killed by : com.adventofcode.day05.BinarySpaceTest.[engine:junit-jupiter]/[class:com.adventofcode.day05.BinarySpaceTest]/[method:shouldDisplayNicely()] replaced return value with "" for com/adventofcode/day05/BinarySpace::toString → KILLED
|
16 |
|
1.1 Location : decode Killed by : com.adventofcode.day05.ColumnBinarySpacePartitionTest.[engine:junit-jupiter]/[class:com.adventofcode.day05.ColumnBinarySpacePartitionTest]/[method:shouldDecodeRowFromInput()] Changed increment from 1 to -1 → KILLED
|
22 |
|
1.1 Location : takeLowerHalf Killed by : com.adventofcode.day05.BinarySpaceTest.[engine:junit-jupiter]/[class:com.adventofcode.day05.BinarySpaceTest]/[method:shouldReduceToSingleValueAfter3SplitsWhenStartingWithSpaceFrom0To7()] negated conditional → KILLED
|
23 |
|
1.1 Location : takeLowerHalf Killed by : com.adventofcode.day05.BinarySpaceTest.[engine:junit-jupiter]/[class:com.adventofcode.day05.BinarySpaceTest]/[method:shouldReduceToSingleValueAfter3SplitsWhenStartingWithSpaceFrom0To7()] Replaced integer subtraction with addition → KILLED
|
27 |
|
1.1 Location : takeUpperHalf Killed by : com.adventofcode.day05.BinarySpaceTest.[engine:junit-jupiter]/[class:com.adventofcode.day05.BinarySpaceTest]/[method:shouldReduceToSingleValueAfter3SplitsWhenStartingWithSpaceFrom0To7()] negated conditional → KILLED
|
28 |
|
1.1 Location : takeUpperHalf Killed by : com.adventofcode.day05.BinarySpaceTest.[engine:junit-jupiter]/[class:com.adventofcode.day05.BinarySpaceTest]/[method:shouldReduceToSingleValueAfter3SplitsWhenStartingWithSpaceFrom0To7()] Replaced integer addition with subtraction → KILLED
|
32 |
|
1.1 Location : getSpaceDelta Killed by : com.adventofcode.day05.BinarySpaceTest.[engine:junit-jupiter]/[class:com.adventofcode.day05.BinarySpaceTest]/[method:shouldReduceToSingleValueAfter3SplitsWhenStartingWithSpaceFrom0To7()] Replaced integer subtraction with addition → KILLED
|
33 |
|
1.1 Location : getSpaceDelta Killed by : com.adventofcode.day05.BinarySpaceTest.[engine:junit-jupiter]/[class:com.adventofcode.day05.BinarySpaceTest]/[method:shouldBeAbleToReduceToItsLowerHalf()] Replaced integer modulus with multiplication → KILLED 2.2 Location : getSpaceDelta Killed by : com.adventofcode.day05.BinarySpaceTest.[engine:junit-jupiter]/[class:com.adventofcode.day05.BinarySpaceTest]/[method:shouldReduceToSingleValueAfter3SplitsWhenStartingWithSpaceFrom0To7()] Replaced integer addition with subtraction → KILLED 3.3 Location : getSpaceDelta Killed by : com.adventofcode.day05.BinarySpaceTest.[engine:junit-jupiter]/[class:com.adventofcode.day05.BinarySpaceTest]/[method:shouldReduceToSingleValueAfter3SplitsWhenStartingWithSpaceFrom0To7()] negated conditional → KILLED 4.4 Location : getSpaceDelta Killed by : com.adventofcode.day05.BinarySpaceTest.[engine:junit-jupiter]/[class:com.adventofcode.day05.BinarySpaceTest]/[method:shouldReduceToSingleValueAfter3SplitsWhenStartingWithSpaceFrom0To7()] replaced int return with 0 for com/adventofcode/day05/BinarySpace::getSpaceDelta → KILLED
|
34 |
|
1.1 Location : getSpaceDelta Killed by : com.adventofcode.day05.BinarySpaceTest.[engine:junit-jupiter]/[class:com.adventofcode.day05.BinarySpaceTest]/[method:shouldBeAbleToReduceToItsLowerHalf()] replaced int return with 0 for com/adventofcode/day05/BinarySpace::getSpaceDelta → KILLED
|
38 |
|
1.1 Location : takeHalf Killed by : com.adventofcode.day05.ColumnBinarySpacePartitionTest.[engine:junit-jupiter]/[class:com.adventofcode.day05.ColumnBinarySpacePartitionTest]/[method:shouldDecodeRowFromInput()] negated conditional → KILLED 2.2 Location : takeHalf Killed by : com.adventofcode.day05.ColumnBinarySpacePartitionTest.[engine:junit-jupiter]/[class:com.adventofcode.day05.ColumnBinarySpacePartitionTest]/[method:shouldDecodeRowFromInput()] negated conditional → KILLED
|
45 |
|
1.1 Location : decode Killed by : com.adventofcode.day05.ColumnBinarySpacePartitionTest.[engine:junit-jupiter]/[class:com.adventofcode.day05.ColumnBinarySpacePartitionTest]/[method:shouldDecodeRowFromInput()] changed conditional boundary → KILLED 2.2 Location : decode Killed by : com.adventofcode.day05.ColumnBinarySpacePartitionTest.[engine:junit-jupiter]/[class:com.adventofcode.day05.ColumnBinarySpacePartitionTest]/[method:shouldDecodeRowFromInput()] negated conditional → KILLED
|