Group.kt

1
package com.adventofcode.day06
2
3
class Group(private val persons: List<Person>) {
4
5
    constructor() : this(Person(""))
6
    constructor(onePerson: Person) : this(listOf(onePerson))
7
8
    fun  questionAtLeastOnePersonAnswered(): Int {
9 1 1. questionAtLeastOnePersonAnswered : replaced int return with 0 for com/adventofcode/day06/Group::questionAtLeastOnePersonAnswered → KILLED
        return persons.map { it.answers }.flatten().distinct().count()
10
11
    }
12
13
    fun  questionEveryPersonAnswered(): Int {
14
        return 'a'.rangeTo('z')
15 2 1. questionEveryPersonAnswered : negated conditional → KILLED
2. questionEveryPersonAnswered : negated conditional → KILLED
                .filter { char -> persons.map { it.answers }.all { it.contains(char) } }
16 1 1. questionEveryPersonAnswered : replaced int return with 0 for com/adventofcode/day06/Group::questionEveryPersonAnswered → KILLED
                .count()
17
18
    }
19
20
    override fun toString(): String {
21 2 1. toString : replaced return value with "" for com/adventofcode/day06/Group::toString → KILLED
2. invoke : replaced return value with "" for com/adventofcode/day06/Group$toString$1::invoke → KILLED
        return "Group of ${persons.size} person(s):"+persons.joinToString { "\n\t$it" }
22
    }
23
24
    companion object {
25
        fun readFrom(input: String): Group {
26
            return Group(input.split("\n").map(::Person))
27
        }
28
    }
29
30
}

Mutations

9

1.1
Location : questionAtLeastOnePersonAnswered
Killed by : com.adventofcode.day06.GroupTest.[engine:junit-jupiter]/[class:com.adventofcode.day06.GroupTest]/[method:shouldCountDistinctlyAnswersOfAllPersonsInTheGroupUsingAnyoneCountingMethod()]
replaced int return with 0 for com/adventofcode/day06/Group::questionAtLeastOnePersonAnswered → KILLED

15

1.1
Location : questionEveryPersonAnswered
Killed by : com.adventofcode.day06.GroupTest.[engine:junit-jupiter]/[class:com.adventofcode.day06.GroupTest]/[method:shouldCountDistinctlyAnswersOfAllPersonsInTheGroupUsingEveryoneCountingMethod()]
negated conditional → KILLED

2.2
Location : questionEveryPersonAnswered
Killed by : com.adventofcode.day06.GroupTest.[engine:junit-jupiter]/[class:com.adventofcode.day06.GroupTest]/[method:shouldCountDistinctlyAnswersOfAllPersonsInTheGroupUsingEveryoneCountingMethod()]
negated conditional → KILLED

16

1.1
Location : questionEveryPersonAnswered
Killed by : com.adventofcode.day06.GroupTest.[engine:junit-jupiter]/[class:com.adventofcode.day06.GroupTest]/[method:shouldCountDistinctlyAnswersOfAllPersonsInTheGroupUsingEveryoneCountingMethod()]
replaced int return with 0 for com/adventofcode/day06/Group::questionEveryPersonAnswered → KILLED

21

1.1
Location : toString
Killed by : com.adventofcode.day06.GroupTest.[engine:junit-jupiter]/[class:com.adventofcode.day06.GroupTest]/[method:shouldCountAnswerWhenEveryOneAnswerIt()]
replaced return value with "" for com/adventofcode/day06/Group::toString → KILLED

2.2
Location : invoke
Killed by : com.adventofcode.day06.GroupTest.[engine:junit-jupiter]/[class:com.adventofcode.day06.GroupTest]/[method:shouldCountAnswerWhenEveryOneAnswerIt()]
replaced return value with "" for com/adventofcode/day06/Group$toString$1::invoke → KILLED

42

1.1
Location : questionEveryPersonAnswered
Killed by : none
negated conditional → SURVIVED

2.2
Location : questionEveryPersonAnswered
Killed by : com.adventofcode.day06.GroupTest.[engine:junit-jupiter]/[class:com.adventofcode.day06.GroupTest]/[method:shouldCountDistinctlyAnswersOfAllPersonsInTheGroupUsingEveryoneCountingMethod()]
negated conditional → KILLED

Active mutators

Tests examined


Report generated by PIT 1.6.1