1
|
|
package com.adventofcode.day03 |
2
|
|
|
3
|
1
1. getGridLines : replaced return value with Collections.emptyList for com/adventofcode/day03/Grid::getGridLines → NO_COVERAGE
|
class Grid(val gridLines: List<String>) { |
4
|
|
|
5
|
|
companion object { |
6
|
|
fun fromInput(grisAsString: String): Grid { |
7
|
|
return Grid(grisAsString |
8
|
|
.split("\n") |
9
|
|
.toList()) |
10
|
|
} |
11
|
|
} |
12
|
|
|
13
|
|
private var maxCharacterInPattern: Int = gridLines[0].length |
14
|
|
private var positionOnColumns: Int = 0 |
15
|
|
private var positionOnLine: Int = 0 |
16
|
|
|
17
|
|
fun moveRightBy(moveRightBy: Int) { |
18
|
1
1. moveRightBy : Replaced integer addition with subtraction → KILLED
|
val newIndex = positionOnColumns + moveRightBy |
19
|
1
1. moveRightBy : Replaced integer modulus with multiplication → KILLED
|
positionOnColumns = newIndex.rem(maxCharacterInPattern) |
20
|
|
} |
21
|
|
|
22
|
|
fun moveDownBy(moveDowndBy: Int) { |
23
|
1
1. moveDownBy : Replaced integer addition with subtraction → TIMED_OUT
|
positionOnLine += moveDowndBy |
24
|
|
} |
25
|
|
|
26
|
|
fun getPosition(): Triple<Int, Int, Char> { |
27
|
8
1. getPosition : changed conditional boundary → SURVIVED
2. getPosition : changed conditional boundary → SURVIVED
3. getPosition : changed conditional boundary → KILLED
4. getPosition : changed conditional boundary → KILLED
5. getPosition : negated conditional → KILLED
6. getPosition : negated conditional → KILLED
7. getPosition : negated conditional → KILLED
8. getPosition : negated conditional → KILLED
|
val triple = Triple(positionOnLine, positionOnColumns, gridLines.getOrElse(positionOnLine){""}.getOrElse(positionOnColumns){' '}) |
28
|
|
return triple |
29
|
|
} |
30
|
|
|
31
|
|
fun lastLine(): Int { |
32
|
1
1. lastLine : replaced int return with 0 for com/adventofcode/day03/Grid::lastLine → KILLED
|
return gridLines.size |
33
|
|
} |
34
|
|
|
35
|
|
|
36
|
|
} |
| | Mutations |
3 |
|
1.1 Location : getGridLines Killed by : none replaced return value with Collections.emptyList for com/adventofcode/day03/Grid::getGridLines → NO_COVERAGE
|
18 |
|
1.1 Location : moveRightBy Killed by : com.adventofcode.day03.TobogganTrajectoryTest.[engine:junit-jupiter]/[class:com.adventofcode.day03.TobogganTrajectoryTest]/[method:indicatesNumberOfTreeEncounteredWithMoreThan2linesGridAndCheaperSlopesModel()] Replaced integer addition with subtraction → KILLED
|
19 |
|
1.1 Location : moveRightBy Killed by : com.adventofcode.day03.TobogganTrajectoryTest.[engine:junit-jupiter]/[class:com.adventofcode.day03.TobogganTrajectoryTest]/[method:indicatesNumberOfTreeEncounteredWithMoreThan2linesGridAndCheaperSlopesModel()] Replaced integer modulus with multiplication → KILLED
|
23 |
|
1.1 Location : moveDownBy Killed by : none Replaced integer addition with subtraction → TIMED_OUT
|
27 |
|
1.1 Location : getPosition Killed by : none changed conditional boundary → SURVIVED 2.2 Location : getPosition Killed by : com.adventofcode.day03.TobogganTrajectoryTest.[engine:junit-jupiter]/[class:com.adventofcode.day03.TobogganTrajectoryTest]/[method:indicatesNumberOfTreeEncounteredWithMoreThan2linesGridAndCheaperSlopesModel()] changed conditional boundary → KILLED 3.3 Location : getPosition Killed by : none changed conditional boundary → SURVIVED 4.4 Location : getPosition Killed by : com.adventofcode.day03.TobogganTrajectoryTest.[engine:junit-jupiter]/[class:com.adventofcode.day03.TobogganTrajectoryTest]/[method:indicatesNumberOfTreeEncounteredWithMoreThan2linesGridAndCheaperSlopesModel()] changed conditional boundary → KILLED 5.5 Location : getPosition Killed by : com.adventofcode.day03.TobogganTrajectoryTest.[engine:junit-jupiter]/[class:com.adventofcode.day03.TobogganTrajectoryTest]/[method:indicatesNumberOfTreeEncounteredWithMoreThan2linesGridAndCheaperSlopesModel()] negated conditional → KILLED 6.6 Location : getPosition Killed by : com.adventofcode.day03.TobogganTrajectoryTest.[engine:junit-jupiter]/[class:com.adventofcode.day03.TobogganTrajectoryTest]/[method:indicatesNumberOfTreeEncounteredWithMoreThan2linesGridAndCheaperSlopesModel()] negated conditional → KILLED 7.7 Location : getPosition Killed by : com.adventofcode.day03.TobogganTrajectoryTest.[engine:junit-jupiter]/[class:com.adventofcode.day03.TobogganTrajectoryTest]/[method:indicatesNumberOfTreeEncounteredWithMoreThan2linesGridAndCheaperSlopesModel()] negated conditional → KILLED 8.8 Location : getPosition Killed by : com.adventofcode.day03.TobogganTrajectoryTest.[engine:junit-jupiter]/[class:com.adventofcode.day03.TobogganTrajectoryTest]/[method:indicatesNumberOfTreeEncounteredWithMoreThan2linesGridAndCheaperSlopesModel()] negated conditional → KILLED
|
32 |
|
1.1 Location : lastLine Killed by : com.adventofcode.day03.TobogganTrajectoryTest.[engine:junit-jupiter]/[class:com.adventofcode.day03.TobogganTrajectoryTest]/[method:indicatesNumberOfTreeEncounteredWithMoreThan2linesGridAndCheaperSlopesModel()] replaced int return with 0 for com/adventofcode/day03/Grid::lastLine → KILLED
|