Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
582ecdf
add collecting coverage
Jul 28, 2022
54b77f5
add monitoring tool
Aug 2, 2022
cf7bd12
add history updater
Aug 3, 2022
9bbea53
add rendering graphs
SBOne-Kenobi Aug 3, 2022
855d842
update gradle
Aug 4, 2022
42244c8
add more run tries
Aug 4, 2022
5b6f622
add force child process stopping
Aug 8, 2022
60dab2e
update stats transforming
Aug 8, 2022
1dc960f
add github action
Aug 8, 2022
2512ea3
rename action
Aug 8, 2022
43d0947
add documentation
Aug 8, 2022
49526c9
formatting changes
Aug 10, 2022
354bad8
rename tc to testcases
Aug 10, 2022
810e3da
add coverage statistics by source
Aug 10, 2022
b92e067
update examples
Aug 11, 2022
f55f3cd
replace Pair to data class
Aug 15, 2022
a15c16c
optimize coverage storage
Aug 15, 2022
01163cd
fix script
Aug 15, 2022
9b8bb28
add settings description
Aug 15, 2022
3744486
add monitoring settings
Aug 15, 2022
e2818f1
fix jdk path providing
Aug 15, 2022
255c10f
update documentation
Aug 15, 2022
e72fc73
add metadata insertion script
SBOne-Kenobi Aug 17, 2022
4565c0a
add script to build aggregated data
SBOne-Kenobi Aug 17, 2022
0498a1b
update docs
Aug 17, 2022
3c21894
update docs
Aug 18, 2022
d913726
update comments and name
Aug 18, 2022
8f25930
fix version bug
SBOne-Kenobi Aug 18, 2022
7269eee
update json format
Aug 19, 2022
a9eb958
update github action
Aug 19, 2022
bad21c0
update docs
Aug 19, 2022
027f473
update json structure
Aug 22, 2022
f79a417
update java version
Aug 22, 2022
addc03f
update target structure
Aug 22, 2022
ad7257a
fix container and asm
Aug 22, 2022
58e7a23
fix statistics naming and deprecated functions
Aug 22, 2022
8ea27fb
update examples
Aug 22, 2022
c5fae35
fix import
Aug 23, 2022
61d34d2
fix gradle instrumentation
Aug 24, 2022
65fc08e
update format
Aug 24, 2022
ed05c00
fix gradle
Aug 24, 2022
bcdf026
fix instrumentation jar
Aug 27, 2022
d53e7aa
fix github action
Aug 29, 2022
22ecbfc
provide comments for scripts
Aug 29, 2022
62d449e
optimize gradle
Aug 29, 2022
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
replace Pair to data class
  • Loading branch information
Rustam Sadykov committed Aug 30, 2022
commit f55f3cdefa6f10e8f9f85167f2a0f2d9209e42f6
25 changes: 15 additions & 10 deletions utbot-junit-contest/src/main/kotlin/org/utbot/contest/Statistics.kt
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,21 @@ class GlobalStats {
get() = statsForClasses.count { it.failedToCompile }

val coveredInstructionsCount: Int
get() = statsForClasses.sumBy { it.coverage.getCoverageInfo(it.className).first }
get() = statsForClasses.sumBy { it.coverage.getCoverageInfo(it.className).covered }

val coveredInstructionsCountByFuzzing: Int
get() = statsForClasses.sumBy { it.fuzzedCoverage.getCoverageInfo(it.className).first }
get() = statsForClasses.sumBy { it.fuzzedCoverage.getCoverageInfo(it.className).covered }

val coveredInstructionsCountByConcolic: Int
get() = statsForClasses.sumBy { it.concolicCoverage.getCoverageInfo(it.className).first }
get() = statsForClasses.sumBy { it.concolicCoverage.getCoverageInfo(it.className).covered }

val totalInstructionsCount: Int
get() = statsForClasses.sumBy { it.coverage?.instructionsCount?.toInt() ?: 0 }

val avgCoverage: Double
get() = statsForClasses
.filter { it.coverage?.instructionsCount?.let { cnt -> cnt != 0L } ?: false }
.map { it.coverage.getCoverageInfo(it.className).run { if (second == 0) 0.0 else 100.0 * first / second } }
.map { it.coverage.getCoverageInfo(it.className).run { if (total == 0) 0.0 else 100.0 * covered / total } }
.average()

override fun toString(): String = "\n<Global statistics> :" +
Expand Down Expand Up @@ -119,7 +119,7 @@ class StatsForClass(val className: String) {
var concolicCoverage: Coverage? = null

private fun Coverage?.prettyInfo(): String =
getCoverageInfo(className).run { "$first/$second" }
getCoverageInfo(className).run { "$covered/$total" }

override fun toString(): String = "\n<StatsForClass> :" +
"\n\tcanceled by timeout = $canceledByTimeout" +
Expand Down Expand Up @@ -178,8 +178,13 @@ class FailReason(private val throwable: Throwable) {

}

private fun Coverage?.getCoverageInfo(className: String): Pair<Int, Int> = this?.run {
coveredInstructions.filter { instr ->
instr.className.startsWith(className)
}.toSet().size to (instructionsCount?.toInt() ?: 0)
} ?: (0 to 0)
data class CoverageStatistic(val covered: Int, val total: Int)

private fun Coverage?.getCoverageInfo(className: String): CoverageStatistic = this?.run {
CoverageStatistic(
coveredInstructions.filter {
instr -> instr.className.startsWith(className)
}.toSet().size,
instructionsCount?.toInt() ?: 0
)
} ?: CoverageStatistic(covered = 0, total = 0)