Point.kt

1
package com.github.sanity.pav
2
3
import java.io.Serializable
4
5
/**
6
 * A point in 2D space, with an optional weight (defaults to 1).
7
 */
8 3 1. getWeight : replaced return of double value with -(x + 1) for com/github/sanity/pav/Point::getWeight → KILLED
2. getX : replaced return of double value with -(x + 1) for com/github/sanity/pav/Point::getX → KILLED
3. getY : replaced return of double value with -(x + 1) for com/github/sanity/pav/Point::getY → KILLED
data class Point @JvmOverloads constructor(val x: Double, val y: Double, val weight: Double = 1.0) : Serializable {
9
    companion object {
10
        private const val serialVersionUID: Long = -56975346295
11
    }
12
13
    fun merge(other: Point): Point {
14 1 1. merge : Replaced double addition with subtraction → KILLED
        val combinedWeight = weight + other.weight
15 4 1. merge : Replaced double multiplication with division → KILLED
2. merge : Replaced double multiplication with division → KILLED
3. merge : Replaced double addition with subtraction → KILLED
4. merge : Replaced double division with multiplication → KILLED
        val nx = ((x * weight) + (other.x * other.weight)) / combinedWeight
16 4 1. merge : Replaced double multiplication with division → KILLED
2. merge : Replaced double multiplication with division → KILLED
3. merge : Replaced double addition with subtraction → KILLED
4. merge : Replaced double division with multiplication → KILLED
        val ny = ((y * weight) + (other.y * other.weight)) / combinedWeight
17 1 1. merge : mutated return of Object value for com/github/sanity/pav/Point::merge to ( if (x != null) null else throw new RuntimeException ) → KILLED
        return Point(nx, ny, combinedWeight)
18
    }
19
20 2 1. toString : negated conditional → KILLED
2. toString : mutated return of Object value for com/github/sanity/pav/Point::toString to ( if (x != null) null else throw new RuntimeException ) → KILLED
    override fun toString() = "($x, $y${if (weight != 1.0) " :$weight" else ""})"
21
}

Mutations

8

1.1
Location : getWeight
Killed by : com.github.sanity.pav.PairAdjacentViolatorsSpec.com.github.sanity.pav.PairAdjacentViolatorsSpec
replaced return of double value with -(x + 1) for com/github/sanity/pav/Point::getWeight → KILLED

2.2
Location : getX
Killed by : com.github.sanity.pav.spline.SecantsCalculatorSpec.com.github.sanity.pav.spline.SecantsCalculatorSpec
replaced return of double value with -(x + 1) for com/github/sanity/pav/Point::getX → KILLED

3.3
Location : getY
Killed by : com.github.sanity.pav.spline.SecantsCalculatorSpec.com.github.sanity.pav.spline.SecantsCalculatorSpec
replaced return of double value with -(x + 1) for com/github/sanity/pav/Point::getY → KILLED

14

1.1
Location : merge
Killed by : com.github.sanity.pav.PairAdjacentViolatorsSpec.com.github.sanity.pav.PairAdjacentViolatorsSpec
Replaced double addition with subtraction → KILLED

15

1.1
Location : merge
Killed by : com.github.sanity.pav.PairAdjacentViolatorsSpec.com.github.sanity.pav.PairAdjacentViolatorsSpec
Replaced double multiplication with division → KILLED

2.2
Location : merge
Killed by : com.github.sanity.pav.PairAdjacentViolatorsSpec.com.github.sanity.pav.PairAdjacentViolatorsSpec
Replaced double multiplication with division → KILLED

3.3
Location : merge
Killed by : com.github.sanity.pav.PairAdjacentViolatorsSpec.com.github.sanity.pav.PairAdjacentViolatorsSpec
Replaced double addition with subtraction → KILLED

4.4
Location : merge
Killed by : com.github.sanity.pav.PairAdjacentViolatorsSpec.com.github.sanity.pav.PairAdjacentViolatorsSpec
Replaced double division with multiplication → KILLED

16

1.1
Location : merge
Killed by : com.github.sanity.pav.PairAdjacentViolatorsSpec.com.github.sanity.pav.PairAdjacentViolatorsSpec
Replaced double multiplication with division → KILLED

2.2
Location : merge
Killed by : com.github.sanity.pav.PairAdjacentViolatorsSpec.com.github.sanity.pav.PairAdjacentViolatorsSpec
Replaced double multiplication with division → KILLED

3.3
Location : merge
Killed by : com.github.sanity.pav.PairAdjacentViolatorsSpec.com.github.sanity.pav.PairAdjacentViolatorsSpec
Replaced double addition with subtraction → KILLED

4.4
Location : merge
Killed by : com.github.sanity.pav.PairAdjacentViolatorsSpec.com.github.sanity.pav.PairAdjacentViolatorsSpec
Replaced double division with multiplication → KILLED

17

1.1
Location : merge
Killed by : com.github.sanity.pav.PairAdjacentViolatorsSpec.com.github.sanity.pav.PairAdjacentViolatorsSpec
mutated return of Object value for com/github/sanity/pav/Point::merge to ( if (x != null) null else throw new RuntimeException ) → KILLED

20

1.1
Location : toString
Killed by : com.github.sanity.pav.PairAdjacentViolatorsSpec.com.github.sanity.pav.PairAdjacentViolatorsSpec
negated conditional → KILLED

2.2
Location : toString
Killed by : com.github.sanity.pav.PairAdjacentViolatorsSpec.com.github.sanity.pav.PairAdjacentViolatorsSpec
mutated return of Object value for com/github/sanity/pav/Point::toString to ( if (x != null) null else throw new RuntimeException ) → KILLED

Active mutators

Tests examined


Report generated by PIT 1.1.10