From a868e2f55b38d2dfd224bbcf1b145c387cd22271 Mon Sep 17 00:00:00 2001 From: Ilya Andreev Date: Wed, 22 Jun 2022 15:23:18 +0300 Subject: [PATCH 1/3] Update pom.xml --- transpiler/pom.xml | 2 -- 1 file changed, 2 deletions(-) diff --git a/transpiler/pom.xml b/transpiler/pom.xml index 23f7744e5..c95f66896 100644 --- a/transpiler/pom.xml +++ b/transpiler/pom.xml @@ -110,7 +110,6 @@ **/Test*.* **/*Suite.* - true @@ -136,7 +135,6 @@ **/Test*.* **/*Suite.* - true From 294df98c7c6e15f58d6a3184f06ee4fba0c325a7 Mon Sep 17 00:00:00 2001 From: Ilya Andreev Date: Thu, 23 Jun 2022 14:44:36 +0300 Subject: [PATCH 2/3] Enabled counter --- .../py2eo/transpiler/TestEnabledCounter.scala | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 transpiler/src/test/scala/org/polystat/py2eo/transpiler/TestEnabledCounter.scala diff --git a/transpiler/src/test/scala/org/polystat/py2eo/transpiler/TestEnabledCounter.scala b/transpiler/src/test/scala/org/polystat/py2eo/transpiler/TestEnabledCounter.scala new file mode 100644 index 000000000..08d1fe9e6 --- /dev/null +++ b/transpiler/src/test/scala/org/polystat/py2eo/transpiler/TestEnabledCounter.scala @@ -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 +} \ No newline at end of file From bae5bc147feea107ae503556ac8f9db190f7dad4 Mon Sep 17 00:00:00 2001 From: dours Date: Thu, 23 Jun 2022 21:22:14 +0300 Subject: [PATCH 3/3] this test actually works, so enable it --- .../expressions/evaluation-order/evaluation-order-plus.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/transpiler/src/test/resources/org/polystat/py2eo/transpiler/simple-tests/expressions/evaluation-order/evaluation-order-plus.yaml b/transpiler/src/test/resources/org/polystat/py2eo/transpiler/simple-tests/expressions/evaluation-order/evaluation-order-plus.yaml index c727c8a4c..4bea96734 100644 --- a/transpiler/src/test/resources/org/polystat/py2eo/transpiler/simple-tests/expressions/evaluation-order/evaluation-order-plus.yaml +++ b/transpiler/src/test/resources/org/polystat/py2eo/transpiler/simple-tests/expressions/evaluation-order/evaluation-order-plus.yaml @@ -1,4 +1,4 @@ -enabled: False +enabled: True python: | def evaluationOrder(): xlist = []