generateGraph.kt

1
package com.github.sanity.pav.examples
2
3
import com.github.sanity.pav.PairAdjacentViolators
4
import com.github.sanity.pav.Point
5
import java.util.*
6
7
/**
8
 * Generate the example graph used in README.md
9
 */
10
11
fun main(args: Array<String>) {
12
    val rand = Random()
13
    val points = ArrayList<Point>()
14 4 1. main : changed conditional boundary → NO_COVERAGE
2. main : Changed increment from 1 to -1 → NO_COVERAGE
3. main : negated conditional → NO_COVERAGE
4. main : negated conditional → NO_COVERAGE
    for (x in 0 .. 100) {
15 3 1. main : Replaced double subtraction with addition → NO_COVERAGE
2. main : Replaced double multiplication with division → NO_COVERAGE
3. main : Replaced double addition with subtraction → NO_COVERAGE
        points.add(Point(x.toDouble(), funX(x.toDouble()) + ((rand.nextDouble()-0.5) * 5000.0)))
16
    }
17
    val startTime = System.nanoTime()
18
    val pav = PairAdjacentViolators(points)
19
    val interpolator = pav.interpolator()
20
    val mergedPoints = pav.isotonicPoints
21 2 1. main : Replaced long subtraction with addition → NO_COVERAGE
2. main : removed call to java/io/PrintStream::println → NO_COVERAGE
    println("Took ${System.nanoTime()-startTime}ns to build PAV for ${points.size} input points resulting in ${mergedPoints.size} merged points")
22 1 1. main : negated conditional → NO_COVERAGE
    for (p in points) {
23 1 1. main : removed call to java/io/PrintStream::println → NO_COVERAGE
        println("${p.x}\t${p.y}\t${interpolator(p.x)}")
24
    }
25
}
26
27 4 1. funX : Replaced double multiplication with division → NO_COVERAGE
2. funX : Replaced double multiplication with division → NO_COVERAGE
3. funX : Replaced double addition with subtraction → NO_COVERAGE
4. funX : replaced return of double value with -(x + 1) for com/github/sanity/pav/examples/GenerateGraphKt::funX → NO_COVERAGE
fun funX(x: Double): Double = x + 0.1 * x * x
28

Mutations

14

1.1
Location : main
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : main
Killed by : none
Changed increment from 1 to -1 → NO_COVERAGE

3.3
Location : main
Killed by : none
negated conditional → NO_COVERAGE

4.4
Location : main
Killed by : none
negated conditional → NO_COVERAGE

15

1.1
Location : main
Killed by : none
Replaced double subtraction with addition → NO_COVERAGE

2.2
Location : main
Killed by : none
Replaced double multiplication with division → NO_COVERAGE

3.3
Location : main
Killed by : none
Replaced double addition with subtraction → NO_COVERAGE

21

1.1
Location : main
Killed by : none
Replaced long subtraction with addition → NO_COVERAGE

2.2
Location : main
Killed by : none
removed call to java/io/PrintStream::println → NO_COVERAGE

22

1.1
Location : main
Killed by : none
negated conditional → NO_COVERAGE

23

1.1
Location : main
Killed by : none
removed call to java/io/PrintStream::println → NO_COVERAGE

27

1.1
Location : funX
Killed by : none
Replaced double multiplication with division → NO_COVERAGE

2.2
Location : funX
Killed by : none
Replaced double multiplication with division → NO_COVERAGE

3.3
Location : funX
Killed by : none
Replaced double addition with subtraction → NO_COVERAGE

4.4
Location : funX
Killed by : none
replaced return of double value with -(x + 1) for com/github/sanity/pav/examples/GenerateGraphKt::funX → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.1.10