Mentions légales du service

Skip to content
Snippets Groups Projects
Commit d261dd38 authored by VIGNET Pierre's avatar VIGNET Pierre
Browse files

[lib] Tests: test_antlr_optimization; reactivation of a test deactivated for lack of file available

parent 6564052a
No related branches found
No related tags found
No related merge requests found
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
Unitary tests for the translators Unitary tests for the translators
""" """
from __future__ import print_function from __future__ import print_function
import pkg_resources
import unittest import unittest
import sys import sys
...@@ -770,21 +771,37 @@ class TestFull(unittest.TestCase): ...@@ -770,21 +771,37 @@ class TestFull(unittest.TestCase):
TRACE_FILE.write( 'place_clocks'+ cl_ds.place_clocks.__str__()+'\n') TRACE_FILE.write( 'place_clocks'+ cl_ds.place_clocks.__str__()+'\n')
TRACE_FILE.write( 'inputs'+ cl_ds.inputs.__str__()+'\n') TRACE_FILE.write( 'inputs'+ cl_ds.inputs.__str__()+'\n')
@unittest.skip("Test files not provided") def test_antlr_optimization(self):
def test_tgf_no_clock(self): """Optimization gain comparison when using MCLTranslator optimizations
""" for ANTLR translation (subexpression elimination)
optimisation gain comparison
.. note:: Use test file instead of not provided:
"../ucl/examples/test_tgfb_ref_300511.bcx"
""" """
rep = ErrorRep() rep = ErrorRep()
mcla = MCLAnalyser(rep) mcla = MCLAnalyser(rep)
mcla.opti = False mcla.translator_opti = False
mcla.build_from_chart_file("../ucl/examples/test_tgfb_ref_300511.bcx") filename = pkg_resources.resource_filename(
mess = '\n- NB Clauses:' + str(len(mcla.dynamical_system.list_clauses)) __name__, # package name
TRACE_FILE.write(mess) "../../guard_transitions/translators/tests/tgf_cano_noclock_cmp.cal"
)
mcla.build_from_cadlang(filename)
nb_clauses_without_opti = len(mcla.dynamic_system.list_clauses)
TRACE_FILE.write('\n- NB Clauses:' + str(nb_clauses_without_opti))
mcla = MCLAnalyser(rep) mcla = MCLAnalyser(rep)
mcla.build_from_chart_file("../ucl/examples/test_tgfb_ref_300511.bcx") filename = pkg_resources.resource_filename(
mess = '\n- NB Clauses:' + str(len(mcla.dynamical_system.list_clauses)) __name__, # package name
TRACE_FILE.write(mess) "../../guard_transitions/translators/tests/tgf_cano_noclock_cmp.cal"
)
mcla.build_from_cadlang(filename)
nb_clauses_with_opti = len(mcla.dynamic_system.list_clauses)
TRACE_FILE.write('\n- NB Clauses:' + str(nb_clauses_with_opti))
assert nb_clauses_with_opti < nb_clauses_without_opti
assert nb_clauses_with_opti == 1573
assert nb_clauses_without_opti == 1909
class TestMCLSigExprVisitor (unittest.TestCase): class TestMCLSigExprVisitor (unittest.TestCase):
""" """
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment