-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added functional test on branch counter
- Loading branch information
Showing
5 changed files
with
86 additions
and
19 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
src/functionalTest/kotlin/kotlinx/kover/test/functional/cases/counters/BranchCounterTests.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package kotlinx.kover.test.functional.cases.counters | ||
|
||
import kotlinx.kover.api.* | ||
import kotlinx.kover.test.functional.cases.utils.* | ||
import kotlinx.kover.test.functional.core.BaseGradleScriptTest | ||
import kotlin.test.* | ||
|
||
internal class BranchCounterTests: BaseGradleScriptTest() { | ||
@Test | ||
fun testBranchCounter() { | ||
builder("Test simple branch counters") | ||
.engines(CoverageEngine.INTELLIJ, CoverageEngine.JACOCO) | ||
.sources("branches") | ||
.build() | ||
.run("build") { | ||
xml(defaultXmlReport()) { | ||
val counter = methodCounter("org.jetbrains.MyBranchedClass", "foo", type = "BRANCH") | ||
assertNotNull(counter) | ||
assertEquals(1, counter.covered) | ||
assertEquals(3, counter.missed) | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
src/functionalTest/templates/sources/branches/main/kotlin/Sources.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package org.jetbrains | ||
|
||
class MyBranchedClass { | ||
fun foo(value: Int) { | ||
if (value < 0) { | ||
println("LE") | ||
} else if (value == 0) { | ||
println("EQ") | ||
} else { | ||
println("GE") | ||
} | ||
} | ||
} | ||
|
11 changes: 11 additions & 0 deletions
11
src/functionalTest/templates/sources/branches/test/kotlin/TestClass.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package org.jetbrains.serialuser | ||
|
||
import org.jetbrains.MyBranchedClass | ||
import kotlin.test.Test | ||
|
||
class TestClass { | ||
@Test | ||
fun testBranches() { | ||
MyBranchedClass().foo(-20) | ||
} | ||
} |