Skip to content

Commit

Permalink
Merge pull request #301 from polystat/master
Browse files Browse the repository at this point in the history
Update branch
  • Loading branch information
AndrewG0R authored Jun 27, 2022
2 parents 2b3b558 + 9815782 commit d36b340
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 3 deletions.
2 changes: 0 additions & 2 deletions transpiler/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@
<exclude>**/Test*.*</exclude>
<exclude>**/*Suite.*</exclude>
</excludes>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>
</plugins>
Expand All @@ -136,7 +135,6 @@
<exclude>**/Test*.*</exclude>
<exclude>**/*Suite.*</exclude>
</excludes>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>
</plugins>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
enabled: False
enabled: True
python: |
def evaluationOrder():
xlist = []
Expand Down
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
}

0 comments on commit d36b340

Please sign in to comment.