-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #301 from polystat/master
Update branch
- Loading branch information
Showing
3 changed files
with
38 additions
and
3 deletions.
There are no files selected for viewing
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
2 changes: 1 addition & 1 deletion
2
...tat/py2eo/transpiler/simple-tests/expressions/evaluation-order/evaluation-order-plus.yaml
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
enabled: False | ||
enabled: True | ||
python: | | ||
def evaluationOrder(): | ||
xlist = [] | ||
|
37 changes: 37 additions & 0 deletions
37
transpiler/src/test/scala/org/polystat/py2eo/transpiler/TestEnabledCounter.scala
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,37 @@ | ||
package org.polystat.py2eo.transpiler | ||
|
||
import org.junit.Test | ||
|
||
import scala.reflect.io.{File, Path} | ||
|
||
class TestEnabledCounter extends Commons { | ||
private val testsPath: Path = "src/test/resources/org/polystat/py2eo/transpiler/simple-tests" | ||
|
||
case class TestResult(name: String, category: String, enabled: Boolean) | ||
|
||
@Test | ||
def test(): Unit = { | ||
val tests = testsPath.toDirectory.deepFiles.filter(_.extension == "yaml").toSet | ||
|
||
/** Set of triplets: test name, category and run result */ | ||
val results = for {test <- tests} yield TestResult(test.name, test.parent.name, isEnabled(test)) | ||
|
||
val total = results.size | ||
val enabled = results.count(_.enabled) | ||
println(s"tests enabled: ${(100f * enabled) / total}% ($enabled of $total)") | ||
|
||
val constructions = results.groupBy(_.category) | ||
val constructionsResults = for {(construction, relevant) <- constructions} yield { | ||
val total = relevant.size | ||
val passed = relevant.count(_.enabled) | ||
val percentage = (100f * passed) / total | ||
println(s"$construction tests passed: $percentage% ($passed of $total)") | ||
|
||
percentage | ||
} | ||
|
||
println(s"total constructions passed: ${constructionsResults.sum / constructionsResults.size}%") | ||
} | ||
|
||
private def isEnabled(file: File): Boolean = yaml2pythonModel(file.jfile).enabled | ||
} |