Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
VIGNET Pierre
cadbiom
Commits
d261dd38
Commit
d261dd38
authored
Dec 19, 2019
by
VIGNET Pierre
Browse files
[lib] Tests: test_antlr_optimization; reactivation of a test deactivated for lack of file available
parent
6564052a
Changes
1
Hide whitespace changes
Inline
Side-by-side
library/cadbiom/models/clause_constraints/mcl/TestMCLTranslators.py
View file @
d261dd38
...
...
@@ -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
):
"""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment