MaskPrograms.kt

1
package com.adventofcode.day14
2
3 1 1. getInput : replaced return value with Collections.emptyList for com/adventofcode/day14/MaskPrograms::getInput → NO_COVERAGE
class MaskPrograms(val input: Collection<String>) {
4
5
6
    fun getMemory(): Long {
7
        var memory = mutableMapOf<Long, Long>()
8
        val data = input.iterator()
9
        var blockData = arrayListOf<Pair<Long, Long>>()
10
11
        var line = ""
12
        var currentBitmask = ""
13
14 1 1. getMemory : negated conditional → KILLED
        while (data.hasNext()) {
15
            line = data.next()
16
            when (line.substring(0,3)) {
17
                "mem" -> blockData.add(
18
                        line.substringBefore(" =").substringAfter("[").dropLast(1).toLong() to
19
                                line.substringAfter("= ").toLong()
20
                )
21
                else ->
22 1 1. getMemory : negated conditional → KILLED
                    if (line.startsWith("mask = ")) {
23 2 1. getMemory : changed conditional boundary → SURVIVED
2. getMemory : negated conditional → KILLED
                        if (blockData.size > 0) {
24 1 1. getMemory : removed call to java/util/Map::putAll → KILLED
                            memory.putAll(MaskProgram(currentBitmask, *blockData.toTypedArray()).getMemory())
25
                            blockData = arrayListOf()
26
                        }
27
                        currentBitmask = line.split("= ").last()
28
                    }
29
            }
30
        }
31 2 1. getMemory : changed conditional boundary → SURVIVED
2. getMemory : negated conditional → KILLED
        if (blockData.size > 0) {
32 1 1. getMemory : removed call to java/util/Map::putAll → KILLED
            memory.putAll(MaskProgram(currentBitmask, *blockData.toTypedArray()).getMemory())
33
        }
34
35 1 1. getMemory : replaced long return with 0 for com/adventofcode/day14/MaskPrograms::getMemory → KILLED
        return memory.values.sum()
36
37
    }
38
39
40
41
    fun getMemoryV2(): Long {
42
        var memory = mutableMapOf<Long, Long>()
43
        val data = input.iterator()
44
        var blockData = arrayListOf<Pair<Long, Long>>()
45
46
        var line = ""
47
        var currentBitmask = ""
48
49 1 1. getMemoryV2 : negated conditional → KILLED
        while (data.hasNext()) {
50
            line = data.next()
51
            when (line.substring(0,3)) {
52
                "mem" -> blockData.add(
53
                        line.substringBefore(" =").substringAfter("[").dropLast(1).toLong() to
54
                                line.substringAfter("= ").toLong()
55
                )
56
                else ->
57 1 1. getMemoryV2 : negated conditional → KILLED
                    if (line.startsWith("mask = ")) {
58 2 1. getMemoryV2 : changed conditional boundary → SURVIVED
2. getMemoryV2 : negated conditional → KILLED
                        if (blockData.size > 0) {
59 1 1. getMemoryV2 : removed call to java/util/Map::putAll → KILLED
                            memory.putAll(MaskProgram(currentBitmask, *blockData.toTypedArray()).getMemoryV2())
60
                            blockData = arrayListOf()
61
                        }
62
                        currentBitmask = line.split("= ").last()
63
                    }
64
            }
65
        }
66 2 1. getMemoryV2 : changed conditional boundary → SURVIVED
2. getMemoryV2 : negated conditional → KILLED
        if (blockData.size > 0) {
67 1 1. getMemoryV2 : removed call to java/util/Map::putAll → KILLED
            memory.putAll(MaskProgram(currentBitmask, *blockData.toTypedArray()).getMemoryV2())
68
        }
69
70 1 1. getMemoryV2 : replaced long return with 0 for com/adventofcode/day14/MaskPrograms::getMemoryV2 → KILLED
        return memory.values.sum()
71
72
    }
73
74
75
}

Mutations

3

1.1
Location : getInput
Killed by : none
replaced return value with Collections.emptyList for com/adventofcode/day14/MaskPrograms::getInput → NO_COVERAGE

14

1.1
Location : getMemory
Killed by : com.adventofcode.day14.MaskProgramsTest.[engine:junit-jupiter]/[class:com.adventofcode.day14.MaskProgramsTest]/[method:shouldReturnTheSumOfMemoryValues()]
negated conditional → KILLED

22

1.1
Location : getMemory
Killed by : com.adventofcode.day14.MaskProgramsTest.[engine:junit-jupiter]/[class:com.adventofcode.day14.MaskProgramsTest]/[method:shouldReturnTheSumOfMemoryValues()]
negated conditional → KILLED

23

1.1
Location : getMemory
Killed by : none
changed conditional boundary → SURVIVED

2.2
Location : getMemory
Killed by : com.adventofcode.day14.MaskProgramsTest.[engine:junit-jupiter]/[class:com.adventofcode.day14.MaskProgramsTest]/[method:shouldReturnTheSumOfMemoryValues()]
negated conditional → KILLED

24

1.1
Location : getMemory
Killed by : com.adventofcode.day14.MaskProgramsTest.[engine:junit-jupiter]/[class:com.adventofcode.day14.MaskProgramsTest]/[method:shouldReturnTheSumOfMemoryValues()]
removed call to java/util/Map::putAll → KILLED

31

1.1
Location : getMemory
Killed by : none
changed conditional boundary → SURVIVED

2.2
Location : getMemory
Killed by : com.adventofcode.day14.MaskProgramsTest.[engine:junit-jupiter]/[class:com.adventofcode.day14.MaskProgramsTest]/[method:shouldReturnTheSumOfMemoryValues()]
negated conditional → KILLED

32

1.1
Location : getMemory
Killed by : com.adventofcode.day14.MaskProgramsTest.[engine:junit-jupiter]/[class:com.adventofcode.day14.MaskProgramsTest]/[method:shouldReturnTheSumOfMemoryValues()]
removed call to java/util/Map::putAll → KILLED

35

1.1
Location : getMemory
Killed by : com.adventofcode.day14.MaskProgramsTest.[engine:junit-jupiter]/[class:com.adventofcode.day14.MaskProgramsTest]/[method:shouldReturnTheSumOfMemoryValues()]
replaced long return with 0 for com/adventofcode/day14/MaskPrograms::getMemory → KILLED

49

1.1
Location : getMemoryV2
Killed by : com.adventofcode.day14.MaskProgramsTest.[engine:junit-jupiter]/[class:com.adventofcode.day14.MaskProgramsTest]/[method:shouldReturnTheSumOfMemoryValuesForV2()]
negated conditional → KILLED

57

1.1
Location : getMemoryV2
Killed by : com.adventofcode.day14.MaskProgramsTest.[engine:junit-jupiter]/[class:com.adventofcode.day14.MaskProgramsTest]/[method:shouldReturnTheSumOfMemoryValuesForV2()]
negated conditional → KILLED

58

1.1
Location : getMemoryV2
Killed by : none
changed conditional boundary → SURVIVED

2.2
Location : getMemoryV2
Killed by : com.adventofcode.day14.MaskProgramsTest.[engine:junit-jupiter]/[class:com.adventofcode.day14.MaskProgramsTest]/[method:shouldReturnTheSumOfMemoryValuesForV2()]
negated conditional → KILLED

59

1.1
Location : getMemoryV2
Killed by : com.adventofcode.day14.MaskProgramsTest.[engine:junit-jupiter]/[class:com.adventofcode.day14.MaskProgramsTest]/[method:shouldReturnTheSumOfMemoryValuesForV2()]
removed call to java/util/Map::putAll → KILLED

66

1.1
Location : getMemoryV2
Killed by : none
changed conditional boundary → SURVIVED

2.2
Location : getMemoryV2
Killed by : com.adventofcode.day14.MaskProgramsTest.[engine:junit-jupiter]/[class:com.adventofcode.day14.MaskProgramsTest]/[method:shouldReturnTheSumOfMemoryValuesForV2()]
negated conditional → KILLED

67

1.1
Location : getMemoryV2
Killed by : com.adventofcode.day14.MaskProgramsTest.[engine:junit-jupiter]/[class:com.adventofcode.day14.MaskProgramsTest]/[method:shouldReturnTheSumOfMemoryValuesForV2()]
removed call to java/util/Map::putAll → KILLED

70

1.1
Location : getMemoryV2
Killed by : com.adventofcode.day14.MaskProgramsTest.[engine:junit-jupiter]/[class:com.adventofcode.day14.MaskProgramsTest]/[method:shouldReturnTheSumOfMemoryValuesForV2()]
replaced long return with 0 for com/adventofcode/day14/MaskPrograms::getMemoryV2 → KILLED

78

1.1
Location : getMemory
Killed by : com.adventofcode.day14.MaskProgramsTest.[engine:junit-jupiter]/[class:com.adventofcode.day14.MaskProgramsTest]/[method:shouldReturnTheSumOfMemoryValues()]
negated conditional → KILLED

80

1.1
Location : getMemory
Killed by : com.adventofcode.day14.MaskProgramsTest.[engine:junit-jupiter]/[class:com.adventofcode.day14.MaskProgramsTest]/[method:shouldReturnTheSumOfMemoryValues()]
negated conditional → KILLED

82

1.1
Location : getMemoryV2
Killed by : com.adventofcode.day14.MaskProgramsTest.[engine:junit-jupiter]/[class:com.adventofcode.day14.MaskProgramsTest]/[method:shouldReturnTheSumOfMemoryValuesForV2()]
negated conditional → KILLED

84

1.1
Location : getMemoryV2
Killed by : com.adventofcode.day14.MaskProgramsTest.[engine:junit-jupiter]/[class:com.adventofcode.day14.MaskProgramsTest]/[method:shouldReturnTheSumOfMemoryValuesForV2()]
negated conditional → KILLED

Active mutators

Tests examined


Report generated by PIT 1.6.1