DataField.kt

1
package com.adventofcode.day04
2
3
enum class DataField(private val label: String) {
4
5
    BYR("Birth Year") {
6 2 1. validate : replaced boolean return with false for com/adventofcode/day04/DataField$BYR::validate → KILLED
2. validate : replaced boolean return with true for com/adventofcode/day04/DataField$BYR::validate → KILLED
        override fun validate(value: String): Boolean = isInRange(1920, 2002, value)
7
    },
8
    IYR("Issue Year") {
9 2 1. validate : replaced boolean return with false for com/adventofcode/day04/DataField$IYR::validate → KILLED
2. validate : replaced boolean return with true for com/adventofcode/day04/DataField$IYR::validate → KILLED
        override fun validate(value: String): Boolean = isInRange(2010, 2020, value)
10
    },
11
    EYR("Expiration Year") {
12 2 1. validate : replaced boolean return with false for com/adventofcode/day04/DataField$EYR::validate → KILLED
2. validate : replaced boolean return with true for com/adventofcode/day04/DataField$EYR::validate → KILLED
        override fun validate(value: String): Boolean = isInRange(2020, 2030, value)
13
    },
14
    HGT("Height") {
15
        override fun validate(value: String): Boolean = when {
16 1 1. validate : negated conditional → KILLED
            value.endsWith("cm", false) -> isInRange(150, 193, value.substringBefore("cm"))
17 1 1. validate : negated conditional → KILLED
            value.endsWith("in", false) -> isInRange(59, 76, value.substringBefore("in"))
18
            else -> false
19 1 1. validate : replaced boolean return with true for com/adventofcode/day04/DataField$HGT::validate → KILLED
        }
20
    },
21
    HCL("Hair Color") {
22 2 1. validate : replaced boolean return with false for com/adventofcode/day04/DataField$HCL::validate → KILLED
2. validate : replaced boolean return with true for com/adventofcode/day04/DataField$HCL::validate → KILLED
        override fun validate(value: String): Boolean = value.contains(Regex("^#([0-9a-f]){6,6}$"))
23
    },
24
    ECL("Eye Color") {
25
        override fun validate(value: String): Boolean =
26 2 1. validate : replaced boolean return with false for com/adventofcode/day04/DataField$ECL::validate → KILLED
2. validate : replaced boolean return with true for com/adventofcode/day04/DataField$ECL::validate → KILLED
                listOf("amb", "blu", "brn", "gry", "grn", "hzl", "oth").contains(value)
27
    },
28
    PID("Passport ID") {
29 3 1. validate : replaced boolean return with true for com/adventofcode/day04/DataField$PID::validate → KILLED
2. validate : negated conditional → KILLED
3. validate : negated conditional → KILLED
        override fun validate(value: String): Boolean = value.length == 9 && value.toLongOrNull() != null
30
    },
31
    CID("Country ID");
32
33 1 1. validate : replaced boolean return with false for com/adventofcode/day04/DataField::validate → KILLED
    open fun validate(value: String): Boolean = true
34
35
    override fun toString(): String {
36 1 1. toString : replaced return value with "" for com/adventofcode/day04/DataField::toString → KILLED
        return "$name ('$label')"
37
    }
38
39
    internal fun isInRange(lower: Int, higher: Int, value: String) =
40 3 1. isInRange$adventofcode2020 : replaced boolean return with true for com/adventofcode/day04/DataField::isInRange$adventofcode2020 → KILLED
2. isInRange$adventofcode2020 : negated conditional → KILLED
3. isInRange$adventofcode2020 : negated conditional → KILLED
            lower.rangeTo(higher).contains(value.toIntOrNull())
41
}
42

Mutations

6

1.1
Location : validate
Killed by : com.adventofcode.day04.DataFieldTest.[engine:junit-jupiter]/[class:com.adventofcode.day04.DataFieldTest]/[method:shouldValidateDataFieldByrAccordingToItsRules()]
replaced boolean return with false for com/adventofcode/day04/DataField$BYR::validate → KILLED

2.2
Location : validate
Killed by : com.adventofcode.day04.DataFieldTest.[engine:junit-jupiter]/[class:com.adventofcode.day04.DataFieldTest]/[method:shouldValidateDataFieldByrAccordingToItsRules()]
replaced boolean return with true for com/adventofcode/day04/DataField$BYR::validate → KILLED

9

1.1
Location : validate
Killed by : com.adventofcode.day04.DataFieldTest.[engine:junit-jupiter]/[class:com.adventofcode.day04.DataFieldTest]/[method:shouldValidateDataFieldIyrAccordingToItsRules()]
replaced boolean return with false for com/adventofcode/day04/DataField$IYR::validate → KILLED

2.2
Location : validate
Killed by : com.adventofcode.day04.DataFieldTest.[engine:junit-jupiter]/[class:com.adventofcode.day04.DataFieldTest]/[method:shouldValidateDataFieldIyrAccordingToItsRules()]
replaced boolean return with true for com/adventofcode/day04/DataField$IYR::validate → KILLED

12

1.1
Location : validate
Killed by : com.adventofcode.day04.DataFieldTest.[engine:junit-jupiter]/[class:com.adventofcode.day04.DataFieldTest]/[method:shouldValidateDataFieldEyrAccordingToItsRules()]
replaced boolean return with false for com/adventofcode/day04/DataField$EYR::validate → KILLED

2.2
Location : validate
Killed by : com.adventofcode.day04.DataFieldTest.[engine:junit-jupiter]/[class:com.adventofcode.day04.DataFieldTest]/[method:shouldValidateDataFieldEyrAccordingToItsRules()]
replaced boolean return with true for com/adventofcode/day04/DataField$EYR::validate → KILLED

16

1.1
Location : validate
Killed by : com.adventofcode.day04.DataFieldTest.[engine:junit-jupiter]/[class:com.adventofcode.day04.DataFieldTest]/[method:shouldValidateDataFieldHgtAccordingToItsRules()]
negated conditional → KILLED

17

1.1
Location : validate
Killed by : com.adventofcode.day04.DataFieldTest.[engine:junit-jupiter]/[class:com.adventofcode.day04.DataFieldTest]/[method:shouldValidateDataFieldHgtAccordingToItsRules()]
negated conditional → KILLED

19

1.1
Location : validate
Killed by : com.adventofcode.day04.DataFieldTest.[engine:junit-jupiter]/[class:com.adventofcode.day04.DataFieldTest]/[method:shouldValidateDataFieldHgtAccordingToItsRules()]
replaced boolean return with true for com/adventofcode/day04/DataField$HGT::validate → KILLED

22

1.1
Location : validate
Killed by : com.adventofcode.day04.DataFieldTest.[engine:junit-jupiter]/[class:com.adventofcode.day04.DataFieldTest]/[method:shouldValidateDataFieldHclAccordingToItsRules()]
replaced boolean return with false for com/adventofcode/day04/DataField$HCL::validate → KILLED

2.2
Location : validate
Killed by : com.adventofcode.day04.DataFieldTest.[engine:junit-jupiter]/[class:com.adventofcode.day04.DataFieldTest]/[method:shouldValidateDataFieldHclAccordingToItsRules()]
replaced boolean return with true for com/adventofcode/day04/DataField$HCL::validate → KILLED

26

1.1
Location : validate
Killed by : com.adventofcode.day04.DataFieldTest.[engine:junit-jupiter]/[class:com.adventofcode.day04.DataFieldTest]/[method:shouldValidateDataFieldEclAccordingToItsRules()]
replaced boolean return with false for com/adventofcode/day04/DataField$ECL::validate → KILLED

2.2
Location : validate
Killed by : com.adventofcode.day04.DataFieldTest.[engine:junit-jupiter]/[class:com.adventofcode.day04.DataFieldTest]/[method:shouldValidateDataFieldEclAccordingToItsRules()]
replaced boolean return with true for com/adventofcode/day04/DataField$ECL::validate → KILLED

29

1.1
Location : validate
Killed by : com.adventofcode.day04.DataFieldTest.[engine:junit-jupiter]/[class:com.adventofcode.day04.DataFieldTest]/[method:shouldValidateDataFieldPidAccordingToItsRules()]
replaced boolean return with true for com/adventofcode/day04/DataField$PID::validate → KILLED

2.2
Location : validate
Killed by : com.adventofcode.day04.DataFieldTest.[engine:junit-jupiter]/[class:com.adventofcode.day04.DataFieldTest]/[method:shouldValidateDataFieldPidAccordingToItsRules()]
negated conditional → KILLED

3.3
Location : validate
Killed by : com.adventofcode.day04.DataFieldTest.[engine:junit-jupiter]/[class:com.adventofcode.day04.DataFieldTest]/[method:shouldValidateDataFieldPidAccordingToItsRules()]
negated conditional → KILLED

33

1.1
Location : validate
Killed by : com.adventofcode.day04.PassportScannerWithFullValidationTest.[engine:junit-jupiter]/[class:com.adventofcode.day04.PassportScannerWithFullValidationTest]/[method:shouldGiveInvalidityCauseWhenPassportIsInvalid()]
replaced boolean return with false for com/adventofcode/day04/DataField::validate → KILLED

36

1.1
Location : toString
Killed by : com.adventofcode.day04.PassportTest.[engine:junit-jupiter]/[class:com.adventofcode.day04.PassportTest]/[method:shouldDisplayDataNicely()]
replaced return value with "" for com/adventofcode/day04/DataField::toString → KILLED

40

1.1
Location : isInRange$adventofcode2020
Killed by : com.adventofcode.day04.DataFieldTest.[engine:junit-jupiter]/[class:com.adventofcode.day04.DataFieldTest]/[method:shouldValidateDataFieldByrAccordingToItsRules()]
replaced boolean return with true for com/adventofcode/day04/DataField::isInRange$adventofcode2020 → KILLED

2.2
Location : isInRange$adventofcode2020
Killed by : com.adventofcode.day04.DataFieldTest.[engine:junit-jupiter]/[class:com.adventofcode.day04.DataFieldTest]/[method:shouldValidateDataFieldByrAccordingToItsRules()]
negated conditional → KILLED

3.3
Location : isInRange$adventofcode2020
Killed by : com.adventofcode.day04.DataFieldTest.[engine:junit-jupiter]/[class:com.adventofcode.day04.DataFieldTest]/[method:shouldValidateDataFieldByrAccordingToItsRules()]
negated conditional → KILLED

Active mutators

Tests examined


Report generated by PIT 1.6.1