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
......@@ -43,6 +43,7 @@
Unitary tests for the translators
"""
from __future__ import print_function
import pkg_resources
import unittest
import sys
......@@ -770,21 +771,37 @@ class TestFull(unittest.TestCase):
TRACE_FILE.write( 'place_clocks'+ cl_ds.place_clocks.__str__()+'\n')
TRACE_FILE.write( 'inputs'+ cl_ds.inputs.__str__()+'\n')
@unittest.skip("Test files not provided")
def test_tgf_no_clock(self):
"""
optimisation gain comparison
def test_antlr_optimization(self):
"""Optimization gain comparison when using MCLTranslator optimizations
for ANTLR translation (subexpression elimination)
.. note:: Use test file instead of not provided:
"../ucl/examples/test_tgfb_ref_300511.bcx"
"""
rep = ErrorRep()
mcla = MCLAnalyser(rep)
mcla.opti = False
mcla.build_from_chart_file("../ucl/examples/test_tgfb_ref_300511.bcx")
mess = '\n- NB Clauses:' + str(len(mcla.dynamical_system.list_clauses))
TRACE_FILE.write(mess)
mcla.translator_opti = False
filename = pkg_resources.resource_filename(
__name__, # package name
"../../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.build_from_chart_file("../ucl/examples/test_tgfb_ref_300511.bcx")
mess = '\n- NB Clauses:' + str(len(mcla.dynamical_system.list_clauses))
TRACE_FILE.write(mess)
filename = pkg_resources.resource_filename(
__name__, # package name
"../../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):
"""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment