1 | package com.adventofcode.day02 | |
2 | ||
3 | ||
4 | class Password(private val password: String, private val policy: Policy) { | |
5 | ||
6 | companion object { | |
7 | fun fromInput(policy : (String) -> Policy, passwordAndPolicy: String) : Password { | |
8 | val split = passwordAndPolicy.split(":") | |
9 |
1
1. fromInput : negated conditional → KILLED |
return Password(split[1].trim(), policy.invoke(split[0])) |
10 | } | |
11 | } | |
12 | ||
13 | fun isValid(): Boolean { | |
14 |
2
1. isValid : replaced boolean return with false for com/adventofcode/day02/Password::isValid → KILLED 2. isValid : replaced boolean return with true for com/adventofcode/day02/Password::isValid → KILLED |
return policy.checkValidity(password) |
15 | } | |
16 | ||
17 | override fun toString(): String { | |
18 |
1
1. toString : replaced return value with "" for com/adventofcode/day02/Password::toString → NO_COVERAGE |
return "Password '$password' with: $policy" |
19 | } | |
20 | } | |
Mutations | ||
9 |
1.1 |
|
14 |
1.1 2.2 |
|
18 |
1.1 |