Configure a Kotlin Multiplatform application with a JVM target, Jacoco 0.8.7 for test coverage (reproduces with Kover or the Gradle scripting below), and the multik-jvm dependency.
apply(plugin = "java-library")
apply(plugin = "jacoco")
configure<JacocoPluginExtension> {
val jacocoVersion: String by project
toolVersion = jacocoVersion
}
afterEvaluate {
tasks.withType<JacocoReport>().configureEach {
classDirectories.setFrom(
fileTree("${buildDir}/classes/kotlin/jvm/") {
exclude("**/*Test*.*", "**/*Fixture*.*")
}
)
sourceDirectories.setFrom(
// This could be better if it dynamically got the source directories, e.g. more along the lines of
// kotlin.sourceSets["commonMain"].kotlin.sourceDirectories,
// kotlin.sourceSets["jvmMain"].kotlin.sourceDirectories
listOf("src/commonMain/kotlin", "src/jvmMain/kotlin")
)
executionData.setFrom("${buildDir}/jacoco/jvmTest.exec")
}
}
Create a test case that exercises some aspect of Multik, e.g.
@Test
fun epic_fail() {
val top = mk.ndarray(doubleArrayOf(1.0, 2.0, 3.0, 4.0, 5.0))
val bottom = mk.ndarray(doubleArrayOf(6.0, 7.0, 8.0, 9.0, 10.0))
val matrix = mk.stack(top, bottom)
mk.linalg.inv(matrix)
}
Run the tests
RESULTS
Expected
Tests should run regardless of whether coverage is enabled.
STEPS TO REPRODUCE
Configure a Kotlin Multiplatform application with a JVM target, Jacoco 0.8.7 for test coverage (reproduces with Kover or the Gradle scripting below), and the multik-jvm dependency.
Create a test case that exercises some aspect of Multik, e.g.
RESULTS Expected Tests should run regardless of whether coverage is enabled.
Actual Tests fail with a VerifyError